Hi Roger,

first of all, did you put the log4j.jar into WEB-INF/lib? Otherwise your
webapps would use the log4j instance that was created for jboss. I think that
calling PropertyConfigurator.configure(prop) after log4j has been configured
once will not reconfigure it.
Also you do not have configured a rootLogger, so I guess all loggers that
inherit this appender will write to System.out (>server.log).
Did you check, whether anything is written there?

Hope I undetstood log4j now so far, that the above is not complete non-sens.
:)

Greets,

Christian


>Hi,
>  I'm attempting to set up logging using log4j in a jboss servlet.  The
code
>from my servlet looks like
this:
>****************************************************************************
>**********************************************
>        private void initLogging() throws IOException {
>                 PrintWriter out = response.getWriter();
>
>                InputStream is =
>        
>session.getServletContext().getResourceAsStream("log4j.properties");
>                Properties prop = new Properties();
>                prop.load(is);
>                PropertyConfigurator.configure(prop);
>                Logger logger =
>Logger.getLogger("com.tclick.agencyManagement.search.SearchParams");
>            logger.debug("Test");

>****************************************************************************
>***************************************************
>
>My properties file looks like this: 

>****************************************************************************
>****************************************
># Set root logger level to DEBUG and its only appender to AMS.
>log4j.logger.com.tclick.agencyManagement.search.SearchParams=DEBUG,
AMS
>log4j.logger.com.tclick.agencyManagement.search.DistributionSystemsSearch=DE
>BUG, AMS
>
># AMS is set to be a RollingFileAppender
>log4j.appender.AMS=org.apache.log4j.RollingFileAppender
>
>log4j.appender.AMS.File="c:\\agencyManagement.log"
>log4j.appender.AMS.MaxFileSize=100MB
>log4j.appender.AMS.DatePattern='.'yyyy-MM-dd
>log4j.appender.AMS.MaxBackupIndex=1
>
>
>
># AMS uses PatternLayout.
>log4j.appender.AMS.layout=org.apache.log4j.PatternLayout
>log4j.appender.AMS.layout.ConversionPattern=%-4r [%t] %-5p %c %x -
%m%n
>
>****************************************************************************
>******
>
>  The servlet has no problem actually finding the property file.  Once I
>have the property file loaded I have no problems grabbing values from the
>property file and 
>displaying them using the servlet's PrintWriter.  
>  The problem is that the log file never gets created and nothing ever gets
>written to it.  Notice the logger.debug("Test") at the end of the servlet
>code.  That never gets written the specified log file.  
>  As an added piece of information, jboss uses log4j for it's internal
>logging.  Does this have an impact on the way I set up my logging?
>  I am fairly new to log4j.  My goal is to be able to configure log4j here
>in the servlet and allow the rest of the webapp code to be able to grab
>instance of these loggers using the Logger.getLogger(<class>) call.
>
>Thanks in advance
>
>Roger Tucker  

-- 
+++ GMX - die erste Adresse f�r Mail, Message, More +++
Bis 31.1.: TopMail + Digicam f�r nur 29 EUR http://www.gmx.net/topmail


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

Reply via email to