Hi Gary, Thank you for your feedback.
> Java docs and other ambiguous issues I pushed some changes: (a) added Java docs (b) added a couple of examples to the README.md and as a Java source in the test folder. https://github.com/nobeh/log4j-configuration-builder > Regarding the limitations When I started to do this, my main motivations were: 1. Try to drop the need to have a log4j.xml 2. Simplify the glue code that is needed to wrap around Apache Log4j API to prepare a LoggerContext for use 3. Use convention over configuration Based on the above, my usual cases were: - Quickly get a console logger with debug level - Deliver the application artifact in an **embedded** mode with safe default configurations Using the "convention over configuration" approach above, in the debugging/development mode, usually the file appender with/without a strategy is anyway overlooked. When in live mode, the default daily rollover with 30 maximum days to keep seemed to be a reasonable default. That's why - The current implementation does not support syslog appenders yet. - ~ does not support database appenders yet. - ~ does not support simple file appenders yet. If you see the potential, I can work on the implementation to cover some general use cases that are expected to be. The above also somehow addresses how much effort is required to make this part of Core API. Let me know. Thanks, Behrooz On Mon, Mar 2, 2015 at 6:27 PM, Gary Gregory <[email protected]> wrote: > Thank for pointing out your work. > > The lack of Javadoc makes it hard to understand what the builder does or > what is the intent of its scope. For example: > > builder.addAppender(extraAppenderName, > "myapp-extra.log", "myapp-extra.log.%d{yyyy-MM-dd}"); > > Does that always create a rolling file? What if I want to log to a simple > file? Or logging to the console? To a database? > > How broad is the builder supposed to be? > > Is there a way the Core's config code could be made better to either make > this builder redundant or easier to write? > > Thank you! > > Gary > > > > On Mon, Mar 2, 2015 at 7:01 AM, Behrooz Nobakht <[email protected]> wrote: > >> Hi, >> >> It's been a while that I've been using Apache Log4j 2 using no >> configuration file. >> This is quite useful in the context of embedded services and small >> application. >> Basically, all the configuration is done via code and using standard >> Apache Log4j API. >> >> I thought it might be good to extract a very small module to present how >> I have done this so far. >> The result is available at >> https://github.com/nobeh/log4j-configuration-builder >> >> I'd be happy to work on it further as a contribution to the core library >> and consider >> it to be merged into the library. I'd appreciate your feedback and >> thoughts on this. >> >> Thanks, >> Behrooz >> >> > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > -- -- Behrooz Nobakht
