On 24 Sep 2014 at 17:09:51, [email protected] ([email protected](mailto:[email protected])) wrote:
On 24 Sep 2014 at 16:32:53, Denis Gervalle ([email protected](mailto:[email protected])) wrote:
Hi Vincent,
I do not think this is the right way to fix your problem. Basically what you need is some transversal way to filter events. I have never used them, but if IIRC, SL4J implements Markers, which allows to mark some logging, and Logback should support filterinb on Markers. Could you check that solution, it could a better fit for your need IMO.
Good idea, I’ll check.
Ok it may work with Markers but it would work only with Logback. We would have to configure our logback.xml with something like this: http://logback.qos.ch/manual/appenders.html#OnMarkerEvaluator Actually I’m not even sure we can do what we want with this since in all the examples I’ve found you could decide to use a specific appender which is not our use case: we want the same appender but change the log level according to a marker. I think this can be achieved with Filter but that’s not in the SLF4J API AFAIK. Not sure it’s worth tying us to Logback just for this. OTOH having named loggers is something well understood and supported by all logging systems so I’d go for this. Thanks -Vincent
Thanks -Vincent
On Wed, Sep 24, 2014 at 2:06 PM, [email protected] wrote:
Hi Devs,
I’d like to add some logging to debug what happens when XWiki shuts down.
One solution would be to just use the standard class loggers with LOGGER.debug(…).
However this means activating debug logging for everything and thus you cannot just focus on the shutdown part.
WDYT about adding 2 new loggers "org.xwiki.initialization" and “org.xwiki.shutdown”?
Example usage:
/** * Logger to use to log shutdown information. */ private static final Logger SHUTDOWN_LOGGER = LoggerFactory.getLogger("org.xwiki.shutdown");
...
SHUTDOWN_LOGGER.debug("Stopping component [{}]...", instance.getClass().getName()); ... SHUTDOWN_LOGGER.debug("Component [{}] has been stopped", instance.getClass().getName());
Then it becomes easy to set, in logback.xml:
A small variation would be to use SHUTDOWN_LOGGER.info() and in logback.xml, by default to have:
Note that this would be the first time we use non-class loggers which is why I’m asking for your go-ahead.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Denis Gervalle SOFTEC sa - CEO _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs