0 Replies Latest reply on Jan 20, 2010 2:45 PM by nimo stephan

    jboss logging as string

    nimo stephan Master

      In order to use my own log4j.xml-file, I have to do a little work as described here



      It is uncomfortable to do such a overhead only for registering my own log4j.xml.


      First Question:


      Is that workaround also needed for Jboss 5/6 or does jboss 6 has better support for different log4j.xml-files ?



      Second Question:


      I need a appender, which writes my logs into a String (outputstream) - I want to save this string as a Clob into my database.


      I guess, I have to configure such an appender programmatically by using a WriterAppender. So I need to get access to my logger via Code!


      But I do not want to use "org.jboss.logging.Logger" into my application code, as my application code should be application-server-independent !!


      // http://docs.jboss.org/process-guide/en/html/logging.html


      import org.jboss.logging.Logger;

      public class TestABCWrapper
         private static final Logger log = Logger.getLogger(TestABCWrapper.class.getName());

         // Hereafter, the logger may be used with whatever priority level as appropriate.


      How can I do that with log4j-jboss.xml ? Why can I not use the log4j-api? Are there any convenients to do such a thing? (I do NOT want to use the JDBCAppender).


      Or should I read the log-file via FileReader (the file which is in jboss/logs-directory) and convert it to a String?


      What is best practice?