Tom,

You might want to look at using the NDC or MDC classes to store your user
code.  Then you could use a custom filter to print or not print a message
based on the value of the NDC or MDC.

-Mark

-----Original Message-----
From: Tom Innes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 3:23 PM
To: 'Log4J Developers List'
Subject: RE: log4J / JBoss


Hi Ceki,

Maybe you can suggest a better alternative to what we are trying to
accomplish.  We want to log the user code associated with a log message.
Hence the reason we where trying to extend the category class.  Working in a
multi-user environment we want all error messages to include the user code.
In addition we want to be able to selectively turn on debug messages for a
particular user by altering the properties file.  When we do so, we only
want the debug messages for that user.

Any suggestions would be appreciated.

Tom

 -----Original Message-----
From:   Ceki Gülcü [mailto:[EMAIL PROTECTED]]
Sent:   January 29, 2002 5:52 PM
To:     Log4J Developers List
Subject:        Re: log4J / JBoss


Tom,

Do not extend the Category class and your problems will go away. Extending
the
category class is (almost) always a bad idea.

Regards, Ceki


At 17:11 29.01.2002 -0500, you wrote:
>Hello,
>
>I'm not sure if this is the correct place to ask this question, but if not,
>I apologize.
>
>Can anyone assist me in getting log4j to work properly with JBoss 2.4.3? We
>are extending the Category class with a our own. This works fine as a
>standalone java program. We are having problems, however, getting it to
work
>with JBoss.
>
>The log4j.properties file looks like the following:
>
>########################################################
># A log4j properties file suitable for replacing the
># default JBoss ConsoleLogging & FileLogging mbeans.
>
># Set the JBossCategoryFactory as the default CategoryFactory
>log4j.categoryFactory=org.jboss.logging.log4j.JBossCategory$JBossCategoryFa
c
>tory
>
>log4j.rootCategory=DEBUG, Default, Console
>
>### The server.log file appender
>log4j.appender.Default=org.apache.log4j.FileAppender
>log4j.appender.Default.File=../log/server.log
>log4j.appender.Default.layout=org.apache.log4j.PatternLayout
># Use the default JBoss format
>log4j.appender.Default.layout.ConversionPattern=[%c{1}] %m%n
># Truncate if it aleady exists.
>log4j.appender.Default.Append=false
>#Example of turning off logging for a category. Uncomment to turn off.
>#log4j.category.DefaultDS=FATAL
>
>### The console appender
>log4j.appender.Console=org.jboss.logging.log4j.ConsoleAppender
>log4j.appender.Console.Threshold=INFO
>log4j.appender.Console.layout=org.apache.log4j.PatternLayout
>log4j.appender.Console.layout.ConversionPattern=[%c{1}] %m%n
>
># Example of only showing INFO msgs for any categories under org.jboss.util
>#log4j.category.org.jboss.util=INFO
>
># An example of enabling the custom TRACE level priority that is used
># by the JBoss internals to diagnose low level details. This example
># turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
># subpackages. This will produce A LOT of logging output.
>#log4j.category.org.jboss.ejb.plugins=TRACE#org.jboss.logging.log4j.TracePr
i
>ority
>
>
>
># EJBEnterprise Changes FOLLOW..........
>
># A log4j properties file suitable for replacing the
># default JBoss ConsoleLogging & FileLogging mbeans.
>
># Set the JBossCategoryFactory as the default CategoryFactory
>#log4j.rootCategory=DEBUG
>
># Following lines have been added for EJBUserCategory
>
># set up the category factory
>log4j.categoryFactory=com.ejbenterprise.util.logging.EJBUserCategoryFactory
>log4j.factory.ejbuser=Greg
>
># set up the appender
>log4j.appender.EJBUserAppender=org.apache.log4j.FileAppender
>log4j.appender.EJBUserAppender.File=FilteredUser.log
>log4j.appender.EJBUserAppender.layout=com.ejbenterprise.util.logging.EJBUse
r
>PatternLayout
>log4j.appender.EJBUserAppender.layout.ConversionPattern=User: %u [%c{1}]
>%m%n
>log4j.appender.EJBUserAppender.Append=false
>
>
># set up logging for a class
>log4j.category.com.ejbenterprise.util.server=DEBUG, EJBUserAppender
>##################################################
>
>
>Now, when the server starts, we are getting ClassNotFoundException for core
>log4j classes like Category, Priority etc. Does anybody know why this
>happens and what the correct way to configure JBoss / log4j is?
>
>-Tom
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
Ceki Gülcü



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to