logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Kjome" <h...@visi.com>
Subject Re: log4j implementation question
Date Fri, 01 Jun 2007 19:43:37 GMT

This is starting to become the realm of the Tomcat support list.  In any case, 
you need to keep something in mind.  The log4j.jar in common/lib is for 
Tomcat's logging purposes.  If you want to separate Tocmat logging from 
application logging, also put log4j.jar in WEB-INF/lib and your application's 
Log4j config file in WEB-INF/classes.  Don't bother with BasicConfigurator. 
 Log4j will configure itself.

I don't know why you get an error resolving Logger when log4j.jar is in 
common/lib. Then again you are using an ancient version of Tomcat.  I suggest 
you upgrade if you can.

Further questions about Tomcat should go to the Tomcat-user list.


Jake


On Fri, 1 Jun 2007 15:24:39 -0400
  "Propes, Barry L " <barry.l.propes@citi.com> wrote:
> well, some progress.
> 
> I don't get an error, Tomcat doesn't post the INFO messages on startup like 
>it used to (with its logger class?)
> 
> Any way, I made this basic little servlet from their example, but it gives 
>me an error about the package.
> 
> import org.apache.log4j.Logger;
>    import org.apache.log4j.BasicConfigurator;
>    
>    public class Hello {
>    
>      static Logger logger = Logger.getLogger(Hello.class);
>    
>      public
>      static
>      void main(String argv[]) {
>    	BasicConfigurator.configure();
>    	logger.debug("Hello world.");
>    	logger.info("What a beatiful day.");
>      }
>    }
> 
> 
> besides not being able to resolve the symbol of Logger, it (the error) 
>states package org.apache.log4j does not exist.
> 
> Wonder what I'm missing there, if Tomcat can now see Log4j upon startup, but 
>I can't import the package?
> 
> 
> 
> -----Original Message-----
>From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: Friday, June 01, 2007 1:06 PM
> To: Log4J Users List
> Subject: Re: log4j implementation question
> 
> 
> On Fri, 1 Jun 2007 12:31:29 -0400
>  "Propes, Barry L " <barry.l.propes@citi.com> wrote:
>> got this error upon startup for Tomcat when I added it to the common/lib 
>>dir.
>> 
>> log4j:WARN No appenders could be found for logger (org.apa
>> igester).
>> log4j:WARN Please initialize the log4j system properly.
> 
> That's a good sign.  It means Log4j is being used.  Have you put log4j.xml 
>or 
> log4j.properties in common/classes?  Make sure you define a root logger with 
> an appender.  I would set the level to something like "warn" so you don't 
>get 
> any debug or info messages from arbitrary loggers by default.
> 
> Jake
> 
>> 
>> -----Original Message-----
>>From: Jacob Kjome [mailto:hoju@visi.com]
>> Sent: Friday, June 01, 2007 10:35 AM
>> To: Log4J Users List
>> Subject: Re: log4j implementation question
>> 
>> 
>> On Fri, 1 Jun 2007 11:23:54 -0400
>>  "Propes, Barry L " <barry.l.propes@citi.com> wrote:
>>> also, Jake,
>>> 
>>> my commons-logging.jar file (NOT my commons-logging-api.jar, but just 
>>>commons-logging.jar) is in the following dir. for me:
>>> 
>>> $TOMCAT_HOME\server\lib
>>> 
>>> should I throw in the log4j jar file in there as well?
>> 
>> Both need to be, specifically, in common/lib and the Log4j config file has 
>>to 
>> be in common/classes.  But, again, I don't recall how this works with 
>>Tomcat4 
>> which is what I presume you are using based on your use of Tomcat's 
>>FileLogger.
>> 
>> Jake
>> 
>>> 
>>> -----Original Message-----
>>>From: Jacob Kjome [mailto:hoju@visi.com]
>>> Sent: Friday, June 01, 2007 12:32 AM
>>> To: Log4J Users List
>>> Subject: Re: log4j implementation question
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Thu, 31 May 2007 17:24:45 -0400
>>>  "Propes, Barry L " <barry.l.propes@citi.com> wrote:
>>>> ok, I did check out the wizard site, and that's a big help..thanks.
>>>> I really like that.
>>>> 
>>>> While I've put the properties, xml and jar file all in the WEB-INF/lib 
>>>>directory of my app, I still have a problem.
>>>> 
>>>> If I change the server.xml reference in the following tag from 
>>>> org.apache.catalina.logger.FileLogger  to org.apache.log4j.Logger,
>>>> Tomcat balks upon startup.
>>>> 
>>>> I'll keep messing with it...I'll get there.
>>>> 
>>> 
>>> Are you using Log4j for application logging or Server logging?  These are 
>>>two 
>>> very different beasts, expecially with the old version of Tomcat you must be

>>> using, since you are using FileLogger.  I would guess it is 4.0 or something

>>> very old like that.
>>> 
>>>For Application logging, you don't mess with Tomcat's logging at all.  For 
>>> server logging, piping it through Log4j may or may not be possible with 
>>>Tomcat 
>>> 4.xx.  It certainly is with 5.0+ by going through commons-logging.  Also, to

>>> configure Log4j for Tomcat, log4j.properties or log4j.xml would have to be 
>>>in 
>>> commons/classes along with log4j.jar and commons-logging.jar in common/lib. 
>>> Don't mess with this.  You've got enough on your plate with figuring out the

>>> basic workings of Log4j.  Concentrate on using Log4j for logging in your 
>>> application only for now.
>>> 
>>> Jake
>>> 
>>>> -----Original Message-----
>>>>From: Jacob Kjome [mailto:hoju@visi.com]
>>>> Sent: Thursday, May 31, 2007 3:46 PM
>>>> To: Log4J Users List
>>>> Subject: Re: log4j implementation question
>>>> 
>>>> 
>>>> On Thu, 31 May 2007 15:37:37 -0400
>>>>  "Propes, Barry L " <barry.l.propes@citi.com> wrote:
>>>>> thanks, Jake.
>>>>> 
>>>>> I'd looked at the Log4j on Apache's site...are we talking about the same

>>>>>thing?
>>>>> 
>>>> 
>>>> The links have "apache" in them.  Yes, Log4j is part of the Apache Logging

>>>> Project...
>>>> 
>>>> 
>>>>  http://logging.apache.org/log4j/docs/documentation.html
>>>> http://wiki.apache.org/logging-log4j/Log4JProjectPages
>>>> 
>>>> 
>>>> Jake
>>>> 
>>>>> 
>>>>> -----Original Message-----
>>>>>From: Jacob Kjome [mailto:hoju@visi.com]
>>>>> Sent: Thursday, May 31, 2007 1:13 PM
>>>>> To: Log4J Users List
>>>>> Subject: Re: log4j implementation question
>>>>> 
>>>>> 
>>>>> On Thu, 31 May 2007 11:23:34 -0400
>>>>>  "Propes, Barry L " <barry.l.propes@citi.com> wrote:
>>>>>> ok, see my post below
>>>>>> 
>>>>>> -----Original Message-----
>>>>>>From: Jacob Kjome [mailto:hoju@visi.com]
>>>>>> Sent: Wednesday, May 30, 2007 10:32 PM
>>>>>> To: Log4J Users List
>>>>>> Subject: Re: log4j implementation question
>>>>>> 
>>>>>> 
>>>>>> At 03:55 PM 5/30/2007, you wrote:
>>>>>>>You mean WEB-INF/lib, right?  If so, yes.
>>>>>> 
>>>>>>>and put log4j.xml or log4j.properties in WEB-INF/classes
>>>>>> 
>>>>>> Yes, I had put the jar file in there, and just now added the properties
file 
>>>>>>as well. However, I don't find a log4j.xml file anywhere. The only
place I 
>>>>>>find one is in my Eclipse folder workspace, referencing a download
I made of 
>>>>>>Quartz sometime ago. THAT log4j.xml file wouldn't work, I don't think
would 
>>>>>>it?
>>>>>> 
>>>>> 
>>>>> Well, maybe.  How would I know?  You haven't shown it to me.  In any
case, 
>>>>> again, this is an issue of education.  One thing that can help you with

>>>>>config 
>>>>> files are the available wizards at WizardForge...
>>>>> 
>>>>> 1.2.xx XML config file format
>>>>> http://wizardforge.org/pc?action=showVersion&id=65
>>>>> 
>>>>> Properties config file format
>>>>> http://wizardforge.org/pc?action=showVersion&id=62
>>>>> 
>>>>>> 
>>>>>> >You really need to read the basic docs on the Log4j web site
or just 
>>>>>> >use a search engine.  There's tons of information out there on
how to 
>>>>>>>get started with Log4j.  This list is for specific questions,
not a 
>>>>>>>tutorial guide.  Once you get more up to speed, don't hesitate
to ask 
>>>>>>>if you have specific questions.
>>>>>> 
>>>>>> 
>>>>>>>Jake
>>>>>> 
>>>>>> Ok, I'll see if I can find some valid tutorial, because the one I
read in 
>>>>>>that link I included in this post was woefully outdated and inadequate,
and 
>>>>>>further, emailing that guy who authored equally proved fruitless,
as it 
>>>>>>bounced back and he no longer monitors it.
>>>>>> 
>>>>> 
>>>>> Have you looked at the Log4j web site itself or the Log4j Wiki?  There
are 
>>>>> lots of resources besided the link you posted...
>>>>> 
>>>>> http://logging.apache.org/log4j/docs/documentation.html
>>>>> http://wiki.apache.org/logging-log4j/Log4JProjectPages
>>>>> 
>>>>> 
>>>>> Jake
>>>>>  
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>> 
>>>>> 
>>>> 
>>>>  
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>> 
>>>  
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>> 
>>  
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 

  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message