I have put log4j.properties under the directory where I have the class files, i.e. EchoService.class

I have also included the code to test whether the properties file is being loaded, but I think the result is negative b'cos I cannot find the logging in catalina.out file. i.e. the classloader is null.

Thanks anyway.

William

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: "Log4J Users List" <log4j-user@logging.apache.org>
Sent: Tuesday, August 16, 2005 12:19 PM
Subject: Re: Log4j Configuration


Don't put the properties file itself in the classpath, that won't help
anything.  Put the directory or jar file in which the properties file is
stored in the classpath.  There should be no folder package structure
either, i.e. if it's /sandbox/classes, then log4j.properties should be in
that directory, with other classes in, e.g.
/sandbox/classes/org/myorg/myproj.

Also, try out that code snippet I sent in my last post to see which
properties file is actually getting loaded.  And remove that
BasicConfigurator call.

And do this all one step at a time so you know which precise change fixed
your problem!




            "William Mok"
            <[EMAIL PROTECTED]
            m>                                                         To
                                      "Log4J Users List"
            08/16/2005 12:12          <log4j-user@logging.apache.org>
            PM                                                         cc

                                                                  Subject
            Please respond to         Re: Log4j Configuration
              "Log4J Users
                  List"
            <[EMAIL PROTECTED]
             ng.apache.org>






Thanks, I changed the line to log4j.appender.LOGFILE.File=/sandbox/axis.log
reatart tomcat, but the axis.log still does not exist.

Another problem is that even I have specified the properties file in
CLASSPATH, I got this warning when I try to deploy my servlet. Somehow it
just cannot find the properties file ??

log4j:WARN No appenders could be found for logger
(org.apache.axis.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.


----- Original Message -----
From: "Harp, George" <[EMAIL PROTECTED]>
To: "'Log4J Users List'" <log4j-user@logging.apache.org>
Sent: Tuesday, August 16, 2005 12:01 PM
Subject: RE: Log4j Configuration


You seem to be running it to the console -- Sys.out
and axis.log ... if it doesn't hurt your application hard code a
directory
prefix and then you'll know where it ends up
ie
log4j.appender.LOGFILE.File=axis.log

to
log4j.appender.LOGFILE.File=c:\axis.log

in log4j.xml
I can use java properties so maybe try
log4j.appender.LOGFILE.File=$(user.dir}/axis.log

if this is not clear reply and ill find the link for you

-----Original Message-----
From: William Mok [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 16, 2005 1:58 PM
To: Log4J Users List
Subject: Re: Log4j Configuration


Thanks,
I have included the log4j.properties file in the CLASSPATH and restart
tomcat, but I could not find any log file generated under the entire
tomcat
directory, after running the servlet.

----- Original Message -----
From: "Harp, George" <[EMAIL PROTECTED]>
To: "'Log4J Users List'" <log4j-user@logging.apache.org>
Sent: Tuesday, August 16, 2005 10:51 AM
Subject: RE: Log4j Configuration


I don't have to put any configuration code in my appliaction I just make
sure that log4j.properties or log4j.xml is in the clas path.

-----Original Message-----
From: William Mok [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 16, 2005 12:35 PM
To: log4j-user@logging.apache.org
Subject: Log4j Configuration


Hi,

I have the following log4j.properties file:



----------------------------------------------------------------------------

-----------------------------------
# Set root category priority to INFO and its only appender to CONSOLE.
log4j.rootCategory=INFO, CONSOLE
#log4j.rootCategory=INFO, CONSOLE, LOGFILE

# Set the enterprise logger category to FATAL and its only appender to
CONSOLE.
log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n

# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x -
%m%n


----------------------------------------------------------------------------

--------------------------------------------------------

At the same time, I also have the following lines in my java servlet



----------------------------------------------------------------------------

--------------------------------------------------------
          Logger logger = Logger.getLogger(EchoService.class);
               BasicConfigurator.configure();

               SimpleLayout layout = new SimpleLayout();

               FileAppender appender = null;

               try
               {
                       appender = new
FileAppender(layout,"connectionlog.txt",true);
               }


----------------------------------------------------------------------------

------------------------------------------------------------

Questions:

1. So how does this configuration work, does the java code override the
configuration on properties file?
2. What does BasicConfigurator do?
3. In propertes file, log4j.appender.LOGFILE.File=axis.log, but I cannot
find this axis.log anywhere after running the servlet.
In the java servlet, I have the line "appender = new
FileAppender(layout,"connectionlog.txt",true);", but I cannot find the
connectionlog.txt file anywhere.

Thanks.

William


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





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

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





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





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





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

Reply via email to