开发者

Putting logback.xml in application, what about people who want their own logback.xml?

In my program there are two modes: With GUI and without a GUI. when there is a GUI, its imperative that all logging statements be sent to the GUI, otherwise there's really no point. Without a GUI though it doesn't really matter.

The issue is that I expect most (75%?) 开发者_JAVA百科of my users to use the program in GUI mode with default settings. The remaining users I expect will want more advanced logging (logging to a file, logging to a database, no logging at all, etc). The issue though is that if I cater to the 75%, from what I know it will cause pain for the remaining users as my logback.xml file is provided in my application.

The next option would be to force everyone to download the default logback.xml and put it somewhere in their app. It adds flexability, but its just another piece of the setup. Besides, I think its bad to tell everyone "You must put this file in your resources or the GUI won't work". Shouldn't the app provide some default state?

Note that the last option, setup everything problematically, won't work because other parts of the application might load first. For example some Hibernate code runs first which produces a big wall of debug output in the command line. I also think that the GUI should show everything since the application started, not just from the point the GUI loaded.

Any suggestions on what I should do?


I would suggest providing a default logback.xml, then those who need a more advanced configuration can specify it using -Dlogback.configurationFile=...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜