<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hi all,<br><br>Currently I am developing a logging class for weblogic, which functions as a tool for writing to a set of logfiles. Several types of external parties access this class (e.g. other classes, jars, services, etc), potentially concurrent calls. Conceptually it looks like this:<br><br>public class myClass{<br>&nbsp; private static Logger loggerLog = LoggerFactory.getLogger(myClass.class);<br>&nbsp; private static Logger logA = LoggerFactory.getLogger("my.logA");<br>&nbsp; private static Logger logB = LoggerFactory.getLogger("my.logB");<br>&nbsp;<br>&nbsp; public static boolean logStringToA(final String strValue){<br>&nbsp;&nbsp;&nbsp; loggerLog.info("Write String to log A.");<br>&nbsp;&nbsp;&nbsp; logA.info(strValue);<br>&nbsp; }<br>&nbsp;<br>&nbsp; public static boolean logNodeToB(final Node nodeValue){<br>&nbsp;&nbsp;&nbsp; loggerLog.info("Write Node to log B.");<br>&nbsp;&nbsp;&nbsp; // do some stuff with the Node<br>&nbsp;&nbsp;&nbsp; logB.info(nodeToStringFunction(nodeValue));<br>&nbsp; } <br>}<br><br>The problem is that SLF4j gets instantiated with NOP loggers on the first calls to the public methods, possibly due to:<br>http://bugzilla.slf4j.org/show_bug.cgi?id=106<br>http://bugzilla.slf4j.org/show_bug.cgi?id=176<br><br>To fix this problem I try to reload the logback configuration at run-time, explained in http://logback.qos.ch/manual/configuration.html#joranDirectly . However, this means that I will have to reinitialize the loggers in myClass (another call to LoggerFactory.getLogger()) before logging starts. But that would imply using some kind of reloading thread which checks for NOP loggers, which isn't that pretty. Also I would lose any logging calls going on in the meanwhile.<br><br>Anyone has a good idea on how to prevent SLF4j creating these NOP loggers, or a solution for the workaround?<br><br>Best regards,<br><br>Roger<br>

<hr id="ecxEC_[object]">
<br>                                               </div></body>
</html>