<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi.<br>
<br>
The ServletContext backend looked like an abandoned project, and
didn't support serialization. So I forked it and added several
features, including:<br>
<br>
- Zero-configuration: adding webapp-slf4j-logger.jar to the webapp
will enable a default logging, which includes HTTP request IP
addresses as a prefix.<br>
- Custom format, supporting mapped diagnostic contexts.<br>
- Support for serialization and deserialization.<br>
<br>
You can see the result here:
<a class="moz-txt-link-freetext" href="http://arkanovicz.github.io/webapp-slf4j-logger/">http://arkanovicz.github.io/webapp-slf4j-logger/</a><br>
<br>
When the J2EE container itself uses SLF4J, the warning about
multiple bindings will show up, but if the J2EE container does
child-first class loading in the webapp (which most do), everything
will be fine.<br>
<br>
I'm still curious about webbapp login common practices: the main
advantage of using the ServletContext logger is that you don't have
to worry about the physical location of the log file, which is quite
handy when you're packaging a webapp meant to be deployed on
different environments. For instance, configuring logback to log
-let say- in /WEB-INF/log/ involves setting up a JNDI selector and
tweaking the J2EE container configuration (as described in logbak
manual chapter 9), which is not always possible.<br>
<br>
--<br>
Claude<br>
<br>
<div class="moz-cite-prefix">On 21/08/2015 17:18, Claude Brisson
wrote:<br>
</div>
<blockquote cite="mid:55D74147.6080103@renegat.net" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
Hi.<br>
<br>
I have some questions about using slf4j in a J2EE context:<br>
<br>
1) I see there is a ServletContext back-end here: <a
moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/pmahoney/slf4j-servletcontext">https://github.com/pmahoney/slf4j-servletcontext</a><br>
but it doesn't seem referenced on the slf4j website, although it
looks like the only way to have the webapp rely on the container
logger.<br>
Does it mean that it's a standard behavior to ignore the container
logger?<br>
<br>
2) I read in the FAQ: "As of SLF4J version 1.5.3, logger instances
survive serialization. Thus, serialization of the host class no
longer requires any special action, even when loggers are declared
as instance variables."<br>
Would this still be true when using the slf4j-servletcontext
back-end? Let say I want to put a logger as a session attribute.
Since the servlet context initialization may happen *after*
sessions de-serialization, I have some doubts about it...<br>
<br>
Thanks,<br>
<br>
Claude<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
slf4j-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:slf4j-user@qos.ch">slf4j-user@qos.ch</a>
<a class="moz-txt-link-freetext" href="http://mailman.qos.ch/mailman/listinfo/slf4j-user">http://mailman.qos.ch/mailman/listinfo/slf4j-user</a></pre>
</blockquote>
<br>
</body>
</html>