You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Eric Wulff <ew...@gmail.com> on 2005/02/16 02:51:23 UTC

ConsoleAppender and Tomcat

Hi all, I'm new to log4j and am having trouble printing to the
'console'.  I'm able to set a DailyRollingFileAppender and print to
that no problem.  I'm hoping I'm simply confused as to 'where' or
'what' the console actually is.  I understand it to be that linux
command window which I used to issue the './startup.sh' command for
Tomcat.  Can anyone advise?  I did not find any suggestions in faqs or
trouble shoots.

Eric

OS: Fedora Core 2
log4j-1.2.9
jakarta-tomcat-5.0.28

...log4j.properties...
log4j.rootLogger=DEBUG, stdout, dailyRollingFile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L): [%t] %c - %m%n

log4j.appender.dailyRollingFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dailyRollingFile.File=/usr/local/jakarta-tomcat-5.0.28/logs/requests
log4j.appender.dailyRollingFile.DatePattern=yyyy-MM-dd
log4j.appender.dailyRollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.dailyRollingFile.layout.ConversionPattern=%5p %c - %m%n

...code sample...
protected static final Logger logDispatcher =
Logger.getLogger("wms.Dispatcher");
 ...
// logg to file is successful but log to the console (window I started
tomcat in) fails
if(DEBUG){logDispatcher.debug("Dispatcher.login(): set jdbc connection...");}

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


Re: ConsoleAppender and Tomcat

Posted by Karan <ka...@resolution.com>.
You can also change the logger that TC uses. Its defined in server.xml:

<Engine defaultHost="localhost" name="Catalina">
      <Host appBase="webapps" name="localhost">
        <Logger className="org.apache.catalina.logger.FileLogger" 
prefix="localhost_log." suffix=".txt" timestamp="true"/>

Go here to see list of possible loggers:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/catalina/docs/api/index.html

Try using SystemOutLogger and it should do what you want it to.

cheers,
Karan

Paul Smith wrote:

> this is beginning to be more of a Tomcat question, but, what the hey.
>
> in TOMCAT_HOME/bin:
>
> ./catalina.sh run
>
> (note it's not "start", rather it's "run", this runs tomcat 'inline' in
> the console window, you'll see anything that would go into catalina.out
> go to the console window you issued the command)
>
> I still think catalina.out is better to find out what's going of course,
> but I do use 'run' from time to time (easier to CTRL-C it to shut it 
> down)
>
> cheers,
>
> Paul
>
> Eric Wulff wrote:
>
>> Thx Paul, this is exactly where the msgs are going.  Now, I've done a
>> little investigating with no immediate success.  Can you tell me how I
>> can re-direct these messages to print to a Linux command window
>> instead of printing to the file catalina.out, as I intended, i.e. how
>> do I tell Tomcat that standard out is the console from which I started
>> Tomcat in?  I found nothing related to catalina.out in server.xml
>> although I did see where catalina.out is created in catalina.sh.
>>
>> Eric
>>
>>
>>
>> On Wed, 16 Feb 2005 13:06:19 +1100, Paul Smith <ps...@aconex.com> 
>> wrote:
>>
>>
>>> If you have a standard Tomcat setup, look in:
>>>
>>> $TOMCAT_HOME/logs/catalina.out
>>>
>>> This is where stdout goes to with Tomcat configured out of the box.
>>>
>>> Eric Wulff wrote:
>>>
>>>
>>>
>>>> Hi all, I'm new to log4j and am having trouble printing to the
>>>> 'console'.  I'm able to set a DailyRollingFileAppender and print to
>>>> that no problem.  I'm hoping I'm simply confused as to 'where' or
>>>> 'what' the console actually is.  I understand it to be that linux
>>>> command window which I used to issue the './startup.sh' command for
>>>> Tomcat.  Can anyone advise?  I did not find any suggestions in faqs or
>>>> trouble shoots.
>>>>
>>>> Eric
>>>>
>>>> OS: Fedora Core 2
>>>> log4j-1.2.9
>>>> jakarta-tomcat-5.0.28
>>>>
>>>> ...log4j.properties...
>>>> log4j.rootLogger=DEBUG, stdout, dailyRollingFile
>>>> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>>>> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>>>> log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L): [%t] %c 
>>>> - %m%n
>>>>
>>>> log4j.appender.dailyRollingFile=org.apache.log4j.DailyRollingFileAppender 
>>>>
>>>> log4j.appender.dailyRollingFile.File=/usr/local/jakarta-tomcat-5.0.28/logs/requests 
>>>>
>>>> log4j.appender.dailyRollingFile.DatePattern=yyyy-MM-dd
>>>> log4j.appender.dailyRollingFile.layout=org.apache.log4j.PatternLayout
>>>> log4j.appender.dailyRollingFile.layout.ConversionPattern=%5p %c - %m%n
>>>>
>>>> ...code sample...
>>>> protected static final Logger logDispatcher =
>>>> Logger.getLogger("wms.Dispatcher");
>>>> ...
>>>> // logg to file is successful but log to the console (window I started
>>>> tomcat in) fails
>>>> if(DEBUG){logDispatcher.debug("Dispatcher.login(): set jdbc 
>>>> connection...");}
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
>>
>>
>

-- 
CM II
Resolution Systems Inc.
/-- never compromise. what if you compromise and lose? --/


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


Re: ConsoleAppender and Tomcat

Posted by Paul Smith <ps...@aconex.com>.
this is beginning to be more of a Tomcat question, but, what the hey.

in TOMCAT_HOME/bin:

./catalina.sh run

(note it's not "start", rather it's "run", this runs tomcat 'inline' in 
the console window, you'll see anything that would go into catalina.out 
go to the console window you issued the command)

I still think catalina.out is better to find out what's going of course, 
but I do use 'run' from time to time (easier to CTRL-C it to shut it down)

cheers,

Paul

Eric Wulff wrote:

>Thx Paul, this is exactly where the msgs are going.  Now, I've done a
>little investigating with no immediate success.  Can you tell me how I
>can re-direct these messages to print to a Linux command window
>instead of printing to the file catalina.out, as I intended, i.e. how
>do I tell Tomcat that standard out is the console from which I started
>Tomcat in?  I found nothing related to catalina.out in server.xml
>although I did see where catalina.out is created in catalina.sh.
>
>Eric
>
>
>
>On Wed, 16 Feb 2005 13:06:19 +1100, Paul Smith <ps...@aconex.com> wrote:
>  
>
>>If you have a standard Tomcat setup, look in:
>>
>>$TOMCAT_HOME/logs/catalina.out
>>
>>This is where stdout goes to with Tomcat configured out of the box.
>>
>>Eric Wulff wrote:
>>
>>    
>>
>>>Hi all, I'm new to log4j and am having trouble printing to the
>>>'console'.  I'm able to set a DailyRollingFileAppender and print to
>>>that no problem.  I'm hoping I'm simply confused as to 'where' or
>>>'what' the console actually is.  I understand it to be that linux
>>>command window which I used to issue the './startup.sh' command for
>>>Tomcat.  Can anyone advise?  I did not find any suggestions in faqs or
>>>trouble shoots.
>>>
>>>Eric
>>>
>>>OS: Fedora Core 2
>>>log4j-1.2.9
>>>jakarta-tomcat-5.0.28
>>>
>>>...log4j.properties...
>>>log4j.rootLogger=DEBUG, stdout, dailyRollingFile
>>>log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>>>log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>>>log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L): [%t] %c - %m%n
>>>
>>>log4j.appender.dailyRollingFile=org.apache.log4j.DailyRollingFileAppender
>>>log4j.appender.dailyRollingFile.File=/usr/local/jakarta-tomcat-5.0.28/logs/requests
>>>log4j.appender.dailyRollingFile.DatePattern=yyyy-MM-dd
>>>log4j.appender.dailyRollingFile.layout=org.apache.log4j.PatternLayout
>>>log4j.appender.dailyRollingFile.layout.ConversionPattern=%5p %c - %m%n
>>>
>>>...code sample...
>>>protected static final Logger logDispatcher =
>>>Logger.getLogger("wms.Dispatcher");
>>>...
>>>// logg to file is successful but log to the console (window I started
>>>tomcat in) fails
>>>if(DEBUG){logDispatcher.debug("Dispatcher.login(): set jdbc connection...");}
>>>
>>>---------------------------------------------------------------------
>>>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
>
>
>  
>

Re: ConsoleAppender and Tomcat

Posted by Eric Wulff <ew...@gmail.com>.
Thx Paul, this is exactly where the msgs are going.  Now, I've done a
little investigating with no immediate success.  Can you tell me how I
can re-direct these messages to print to a Linux command window
instead of printing to the file catalina.out, as I intended, i.e. how
do I tell Tomcat that standard out is the console from which I started
Tomcat in?  I found nothing related to catalina.out in server.xml
although I did see where catalina.out is created in catalina.sh.

Eric



On Wed, 16 Feb 2005 13:06:19 +1100, Paul Smith <ps...@aconex.com> wrote:
> If you have a standard Tomcat setup, look in:
> 
> $TOMCAT_HOME/logs/catalina.out
> 
> This is where stdout goes to with Tomcat configured out of the box.
> 
> Eric Wulff wrote:
> 
> >Hi all, I'm new to log4j and am having trouble printing to the
> >'console'.  I'm able to set a DailyRollingFileAppender and print to
> >that no problem.  I'm hoping I'm simply confused as to 'where' or
> >'what' the console actually is.  I understand it to be that linux
> >command window which I used to issue the './startup.sh' command for
> >Tomcat.  Can anyone advise?  I did not find any suggestions in faqs or
> >trouble shoots.
> >
> >Eric
> >
> >OS: Fedora Core 2
> >log4j-1.2.9
> >jakarta-tomcat-5.0.28
> >
> >...log4j.properties...
> >log4j.rootLogger=DEBUG, stdout, dailyRollingFile
> >log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> >log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> >log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L): [%t] %c - %m%n
> >
> >log4j.appender.dailyRollingFile=org.apache.log4j.DailyRollingFileAppender
> >log4j.appender.dailyRollingFile.File=/usr/local/jakarta-tomcat-5.0.28/logs/requests
> >log4j.appender.dailyRollingFile.DatePattern=yyyy-MM-dd
> >log4j.appender.dailyRollingFile.layout=org.apache.log4j.PatternLayout
> >log4j.appender.dailyRollingFile.layout.ConversionPattern=%5p %c - %m%n
> >
> >...code sample...
> >protected static final Logger logDispatcher =
> >Logger.getLogger("wms.Dispatcher");
> > ...
> >// logg to file is successful but log to the console (window I started
> >tomcat in) fails
> >if(DEBUG){logDispatcher.debug("Dispatcher.login(): set jdbc connection...");}
> >
> >---------------------------------------------------------------------
> >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


Re: ConsoleAppender and Tomcat

Posted by Paul Smith <ps...@aconex.com>.
If you have a standard Tomcat setup, look in:

$TOMCAT_HOME/logs/catalina.out

This is where stdout goes to with Tomcat configured out of the box.

Eric Wulff wrote:

>Hi all, I'm new to log4j and am having trouble printing to the
>'console'.  I'm able to set a DailyRollingFileAppender and print to
>that no problem.  I'm hoping I'm simply confused as to 'where' or
>'what' the console actually is.  I understand it to be that linux
>command window which I used to issue the './startup.sh' command for
>Tomcat.  Can anyone advise?  I did not find any suggestions in faqs or
>trouble shoots.
>
>Eric
>
>OS: Fedora Core 2
>log4j-1.2.9
>jakarta-tomcat-5.0.28
>
>...log4j.properties...
>log4j.rootLogger=DEBUG, stdout, dailyRollingFile
>log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L): [%t] %c - %m%n
>
>log4j.appender.dailyRollingFile=org.apache.log4j.DailyRollingFileAppender
>log4j.appender.dailyRollingFile.File=/usr/local/jakarta-tomcat-5.0.28/logs/requests
>log4j.appender.dailyRollingFile.DatePattern=yyyy-MM-dd
>log4j.appender.dailyRollingFile.layout=org.apache.log4j.PatternLayout
>log4j.appender.dailyRollingFile.layout.ConversionPattern=%5p %c - %m%n
>
>...code sample...
>protected static final Logger logDispatcher =
>Logger.getLogger("wms.Dispatcher");
> ...
>// logg to file is successful but log to the console (window I started
>tomcat in) fails
>if(DEBUG){logDispatcher.debug("Dispatcher.login(): set jdbc connection...");}
>
>---------------------------------------------------------------------
>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