I think it would be good for log4j2 to have a web page detailing examples of "common configurations" so anyone can mimic what they want. That's how I learn, btw. I just want to see examples and not learn syntax, per se.
Paul On Tue, Dec 3, 2013 at 6:00 PM, John Jenkins <[email protected]> wrote: > I wanted to just give a little (unsolicited) feedback on my experience > with Log4J2. > > When it's configured it's great, but the way it is being configured and > the ability to reconfigure it seem frustratingly complicated. Maybe I am > just not using it correctly, but I have spent about 3 hours now pouring > through documentation and trying things on my own with the simple goal of > changing the root logger's log level and have come up empty-handed. I think > I am doing something wrong, but it seems to be failing silently, which, if > so, is beyond frustrating. > > I have a web application, and it seems very bizarre that you are injecting > a Listener into my web app. The Filter I can partially understand, but it > seems like it would have been much clearer and nicer to say something along > the lines of "please add this listener to your web application to have > Log4J automatically configured." If done that way, I wouldn't need to > reconfigure Log4J2 at all and could, instead, just write my own Listener to > initialize it. Maybe. I have been unsuccessful in even doing that (see, > failing silently). > > What really gets me, though, is how someone is supposed to change the > configuration. Again, maybe I am just missing something, but I feel like, > given the amount of time I have been digging through documentation, it is > something that should be more prominently displayed. You have a method of > auto-detecting what kind of configuration file you are being given when > someone gives you the "log4jConfiguration" property, so why isn't there a > similar method for building a Configuration object? Moreover, why doesn't > LogManager / LoggerContext simply have a more-direct method like, > "reconfigure(String)". LoggerContext does have a "reconfigure()". However, > why it does is unclear, and its documentation simply says, "Reconfigure the > context." shrug. > > I am obviously frustrated. However, I am trying to write this with a > spirit of "this is why I am frustrated" and not just have it come out as me > venting. I hope it helped. > > Also, I did make a SO thread if anyone was feeling generous and wanted to > give me / the community a few pointers: > http://stackoverflow.com/questions/20363908/how-to-configure-log4j2 > > Thanks, > > John > -- Cheers, Paul
