You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Gross <co...@gmail.com> on 2010/09/21 17:46:48 UTC

logging on tomcat 5.5.25

I have an older version of Solr (1.2) running on Tomcat 5.5.25.

All the output for Solr is going to the catalina.out logfile, which
gets rather large and has to be deleted about once a month, requiring
me to stop Tomcat and bring it back up each time.  I'd like to make a
new logfile for Solr that rolls over daily, so that it is easy to
clean up the records with a cron job.

I added swallowOutput="true" to the solr context file.

I have altered the logging.properties file for Tomcat:
handlers = 1catalina.org.apache.juli.FileHandler, ..... ,
6solr.org.apache.juli.FileHandler

6solr.org.apache.juli.FileHandler.level = FINE
6solr.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
6solr.org.apache.juli.FileHandler.prefix = solr.

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].level
= ALL
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].handlers
= 6solr.org.apache.juli.FileHandler

When I restart Tomcat, some entries appear in the new Solr log (saying
the listener & filter have been started), but the normal output from
Solr still goes to the catalina.out.

>From what I've read on the Tomcat documentation, the above entries
should do the trick.  Does anyone have an idea of something else I can
try to solve this problem?  Updating any of the software is not an
option.  I do have a similar question to this one on the Solr mailing
list, but they were saying to use Tomcat to control the logging.

Any help would be greatly appreciated!  Thanks!

-- Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: logging on tomcat 5.5.25

Posted by André Warnier <aw...@ice-sa.com>.
Konstantin Kolinko wrote:
> 2010/9/21 Christopher Gross <co...@gmail.com>:
>> I have an older version of Solr (1.2) running on Tomcat 5.5.25.
>>
> 
> How do they perform their logging? Do they use some logging library?
> If yes, then you should configure that library.
> 
>> I added swallowOutput="true" to the solr context file.
> 
> swallowOutput works for simple things like System.out.println(), but
> it fails in certain more complex cases
> 
> 
> E.g., java.util.logging.ConsoleHandler  (see your logging.properties)
> is created at some early time when the server starts.  It remembers a
> reference to the original System.out (err) stream and thus is not
> affected by swallowOutput.
> 
> 
> Note the following line in logging.properties:
> .handlers = 1catalina.org.apache.juli.FileHandler,
> java.util.logging.ConsoleHandler
> 
> It means that if some event is not logged by other handlers, by
> default it will be logged both by 1st FileHandler and by
> ConsoleHandler.  If you remove ConsoleHandler from that line  those
> events won't be printed to the console (and thus to the catalina.out)
> 
> 
> 
Ah !
(Sorry to the OP, if I barge in uninvited)
The above seems to be exactly what I was missing as information, after Konstantin's 
previous answer to one my own logging questions.

If it may help anyone else :
I have a similar issue but a bit different : on my systems (Debian Linux Lenny), the 
Tomcat startup script configures Tomcat to be started under jsvc, and redirects the 
STDOUT/STDERR of jsvc to the system's SYSLOG.
So I was not getting this application's output into catalina.out, but I was getting all of 
it in /var/log/daemon.log. (And I do not have the source of this application to check 
exactly what it does).
Even after after creating a META-INF/context.xml file for that application, and adding the 
"swallowOutput" attribute to the <Context> element, I am still seeing (not all, but most 
of) this application's output in /var/log/daemon.log.

But the above explains why.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: logging on tomcat 5.5.25

Posted by Christopher Gross <co...@gmail.com>.
Solr uses whatever is pushing it to the web for logging, so that will
be Tomcat in my case.  Log4j can be configured for it, but I do not
have that set up now.  If this proves to be difficult I may give that
a try, in order to get the output from Solr out of the catalina.out
file.

OK, so with the swallowOutput set, if Solr had an error (one hasn't
happened today that I can tell) it should go to the solr.log file that
my settings created?

So should I add my solr logger to the .handlers?  Or will that start
pushing all log entries to the solr.log file?  I cannot remove the
logging completely -- I just need it to go to a different file that
can be rolled.

Thanks for your help!

-- Chris



On Tue, Sep 21, 2010 at 1:03 PM, Konstantin Kolinko
<kn...@gmail.com> wrote:
> 2010/9/21 Christopher Gross <co...@gmail.com>:
>> I have an older version of Solr (1.2) running on Tomcat 5.5.25.
>>
>
> How do they perform their logging? Do they use some logging library?
> If yes, then you should configure that library.
>
>> I added swallowOutput="true" to the solr context file.
>
> swallowOutput works for simple things like System.out.println(), but
> it fails in certain more complex cases
>
>
> E.g., java.util.logging.ConsoleHandler  (see your logging.properties)
> is created at some early time when the server starts.  It remembers a
> reference to the original System.out (err) stream and thus is not
> affected by swallowOutput.
>
>
> Note the following line in logging.properties:
> .handlers = 1catalina.org.apache.juli.FileHandler,
> java.util.logging.ConsoleHandler
>
> It means that if some event is not logged by other handlers, by
> default it will be logged both by 1st FileHandler and by
> ConsoleHandler.  If you remove ConsoleHandler from that line  those
> events won't be printed to the console (and thus to the catalina.out)
>
> Best regards,
> Konstantin Kolinko
>
>
>> All the output for Solr is going to the catalina.out logfile, which
>> gets rather large and has to be deleted about once a month, requiring
>> me to stop Tomcat and bring it back up each time.  I'd like to make a
>> new logfile for Solr that rolls over daily, so that it is easy to
>> clean up the records with a cron job.
>>
>>
>> I have altered the logging.properties file for Tomcat:
>> handlers = 1catalina.org.apache.juli.FileHandler, ..... ,
>> 6solr.org.apache.juli.FileHandler
>>
>> 6solr.org.apache.juli.FileHandler.level = FINE
>> 6solr.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
>> 6solr.org.apache.juli.FileHandler.prefix = solr.
>>
>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].level
>> = ALL
>> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].handlers
>> = 6solr.org.apache.juli.FileHandler
>>
>> When I restart Tomcat, some entries appear in the new Solr log (saying
>> the listener & filter have been started), but the normal output from
>> Solr still goes to the catalina.out.
>>
>> From what I've read on the Tomcat documentation, the above entries
>> should do the trick.  Does anyone have an idea of something else I can
>> try to solve this problem?  Updating any of the software is not an
>> option.  I do have a similar question to this one on the Solr mailing
>> list, but they were saying to use Tomcat to control the logging.
>>
>> Any help would be greatly appreciated!  Thanks!
>>
>> -- Chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: logging on tomcat 5.5.25

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/9/21 Christopher Gross <co...@gmail.com>:
> I have an older version of Solr (1.2) running on Tomcat 5.5.25.
>

How do they perform their logging? Do they use some logging library?
If yes, then you should configure that library.

> I added swallowOutput="true" to the solr context file.

swallowOutput works for simple things like System.out.println(), but
it fails in certain more complex cases


E.g., java.util.logging.ConsoleHandler  (see your logging.properties)
is created at some early time when the server starts.  It remembers a
reference to the original System.out (err) stream and thus is not
affected by swallowOutput.


Note the following line in logging.properties:
.handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler

It means that if some event is not logged by other handlers, by
default it will be logged both by 1st FileHandler and by
ConsoleHandler.  If you remove ConsoleHandler from that line  those
events won't be printed to the console (and thus to the catalina.out)

Best regards,
Konstantin Kolinko


> All the output for Solr is going to the catalina.out logfile, which
> gets rather large and has to be deleted about once a month, requiring
> me to stop Tomcat and bring it back up each time.  I'd like to make a
> new logfile for Solr that rolls over daily, so that it is easy to
> clean up the records with a cron job.
>
>
> I have altered the logging.properties file for Tomcat:
> handlers = 1catalina.org.apache.juli.FileHandler, ..... ,
> 6solr.org.apache.juli.FileHandler
>
> 6solr.org.apache.juli.FileHandler.level = FINE
> 6solr.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
> 6solr.org.apache.juli.FileHandler.prefix = solr.
>
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].level
> = ALL
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/solr].handlers
> = 6solr.org.apache.juli.FileHandler
>
> When I restart Tomcat, some entries appear in the new Solr log (saying
> the listener & filter have been started), but the normal output from
> Solr still goes to the catalina.out.
>
> From what I've read on the Tomcat documentation, the above entries
> should do the trick.  Does anyone have an idea of something else I can
> try to solve this problem?  Updating any of the software is not an
> option.  I do have a similar question to this one on the Solr mailing
> list, but they were saying to use Tomcat to control the logging.
>
> Any help would be greatly appreciated!  Thanks!
>
> -- Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org