You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2009/09/18 20:50:24 UTC

Yet another swallowOutput question

Hello there! I'm trying to redirect some legacy System.out calls in
our app to a different logger. Since tomcat's logging implementation
does not allow one to configure the maximum size of the catalina.out,
we are easily reaching gigabytes of space on that file.

I thought that by just adding:

 <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false"
swallowOutput="true">

Would solve my problems, but, after re-starting the server and calling
a servlet that deliberate calls system.out, the catalina out gets all
the output

Well, tried to configure log4j as explained on
http://tomcat.apache.org/tomcat-6.0-doc/logging.html, did not work as
well, not matter what I do, catalina.out continues to grow. I do know
that we *should* not have any system.out on our code, but as I said,
it's a legacy code and I can't refactor an entire app in time.

Any ideas on how can one avoid the sysout gets logged?

Regards

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


Re: Yet another swallowOutput question

Posted by Mark Thomas <ma...@apache.org>.
Vinicius Carvalho wrote:
> Hello Mark. We have removed from all hosts the swallowOutput and add
> it to the context section of each host. We have also added it to the
> conf/context.xml.
> 
> Yet, the catalina.out keeps growing. We found that some apps, that are
> using System.out/System.err, have their output redirected to
> catalina.out. Also, since we put log4j on our classpath, and
> configured a properties file for tomcat,

Phrases like "added to the classpath" always worry me slightly as the classpath
is something that in 99.9% if cases is best left alone.

> now some apps are outputing
> very verbose logs (DEBUG) to the catalina.out. Those came from ibatis,
> that from some reason (we are checking the sources, but may take a
> while) believes that the log4j is set to DEBUG.
> 
> My first guess is to believe that maybe those apps have a logging
> configuration using DEBUG with a console appender, and that is being
> redirected to catalina.out, would be this the issue?
> 
> We are generating several gigabytes of log per day, requesting us to
> almost remove the log manually each 3-4 days.
> 
> Any ideas?

Fix the apps / raise a bug against the libraries.

Tomcat does what it can given the circumstances but swallowOutput is not a
panacea for apps/libraries with broken logging.

I'm fairly sure that the log4j output isn't going to get trapped by the
swallowOutput option.

Regards,

Mark

> 
> Regards
> 
> On Wed, Sep 23, 2009 at 10:20 AM, Mark Thomas <ma...@apache.org> wrote:
>> Vinicius Carvalho wrote:
>>> Thanks Mark, do I have to set it for each context I have? I'm using
>>> several Hosts with few contexts on each.
>> Yes, but there is a short-cut. Set it in CATALINA_BASE/conf/context.xml
>> and it should apply to all contexts on that instance.
>>
>> Mark
>>
>>> Regards
>>>
>>> On Fri, Sep 18, 2009 at 4:18 PM, Mark Thomas <ma...@apache.org> wrote:
>>>> Vinicius Carvalho wrote:
>>>>> Hello there! I'm trying to redirect some legacy System.out calls in
>>>>> our app to a different logger. Since tomcat's logging implementation
>>>>> does not allow one to configure the maximum size of the catalina.out,
>>>>> we are easily reaching gigabytes of space on that file.
>>>>>
>>>>> I thought that by just adding:
>>>>>
>>>>>  <Host name="localhost"  appBase="webapps"
>>>>>             unpackWARs="true" autoDeploy="true"
>>>>>             xmlValidation="false" xmlNamespaceAware="false"
>>>>> swallowOutput="true">
>>>>>
>>>>> Would solve my problems, but, after re-starting the server and calling
>>>>> a servlet that deliberate calls system.out, the catalina out gets all
>>>>> the output
>>>> Unsurprising, given that swallowOutput is not a valid attribute for a
>>>> Host element. You want Context.
>>>>
>>>> Mark
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
> 
> ---------------------------------------------------------------------
> 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: Yet another swallowOutput question

Posted by Vinicius Carvalho <ja...@gmail.com>.
Hello Mark. We have removed from all hosts the swallowOutput and add
it to the context section of each host. We have also added it to the
conf/context.xml.

Yet, the catalina.out keeps growing. We found that some apps, that are
using System.out/System.err, have their output redirected to
catalina.out. Also, since we put log4j on our classpath, and
configured a properties file for tomcat, now some apps are outputing
very verbose logs (DEBUG) to the catalina.out. Those came from ibatis,
that from some reason (we are checking the sources, but may take a
while) believes that the log4j is set to DEBUG.

My first guess is to believe that maybe those apps have a logging
configuration using DEBUG with a console appender, and that is being
redirected to catalina.out, would be this the issue?

We are generating several gigabytes of log per day, requesting us to
almost remove the log manually each 3-4 days.

Any ideas?

Regards

On Wed, Sep 23, 2009 at 10:20 AM, Mark Thomas <ma...@apache.org> wrote:
> Vinicius Carvalho wrote:
>> Thanks Mark, do I have to set it for each context I have? I'm using
>> several Hosts with few contexts on each.
>
> Yes, but there is a short-cut. Set it in CATALINA_BASE/conf/context.xml
> and it should apply to all contexts on that instance.
>
> Mark
>
>>
>> Regards
>>
>> On Fri, Sep 18, 2009 at 4:18 PM, Mark Thomas <ma...@apache.org> wrote:
>>> Vinicius Carvalho wrote:
>>>> Hello there! I'm trying to redirect some legacy System.out calls in
>>>> our app to a different logger. Since tomcat's logging implementation
>>>> does not allow one to configure the maximum size of the catalina.out,
>>>> we are easily reaching gigabytes of space on that file.
>>>>
>>>> I thought that by just adding:
>>>>
>>>>  <Host name="localhost"  appBase="webapps"
>>>>             unpackWARs="true" autoDeploy="true"
>>>>             xmlValidation="false" xmlNamespaceAware="false"
>>>> swallowOutput="true">
>>>>
>>>> Would solve my problems, but, after re-starting the server and calling
>>>> a servlet that deliberate calls system.out, the catalina out gets all
>>>> the output
>>> Unsurprising, given that swallowOutput is not a valid attribute for a
>>> Host element. You want Context.
>>>
>>> Mark
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>

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


Re: Yet another swallowOutput question

Posted by Mark Thomas <ma...@apache.org>.
Vinicius Carvalho wrote:
> Thanks Mark, do I have to set it for each context I have? I'm using
> several Hosts with few contexts on each.

Yes, but there is a short-cut. Set it in CATALINA_BASE/conf/context.xml
and it should apply to all contexts on that instance.

Mark

> 
> Regards
> 
> On Fri, Sep 18, 2009 at 4:18 PM, Mark Thomas <ma...@apache.org> wrote:
>> Vinicius Carvalho wrote:
>>> Hello there! I'm trying to redirect some legacy System.out calls in
>>> our app to a different logger. Since tomcat's logging implementation
>>> does not allow one to configure the maximum size of the catalina.out,
>>> we are easily reaching gigabytes of space on that file.
>>>
>>> I thought that by just adding:
>>>
>>>  <Host name="localhost"  appBase="webapps"
>>>             unpackWARs="true" autoDeploy="true"
>>>             xmlValidation="false" xmlNamespaceAware="false"
>>> swallowOutput="true">
>>>
>>> Would solve my problems, but, after re-starting the server and calling
>>> a servlet that deliberate calls system.out, the catalina out gets all
>>> the output
>> Unsurprising, given that swallowOutput is not a valid attribute for a
>> Host element. You want Context.
>>
>> Mark
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: Yet another swallowOutput question

Posted by Vinicius Carvalho <ja...@gmail.com>.
Thanks Mark, do I have to set it for each context I have? I'm using
several Hosts with few contexts on each.

Regards

On Fri, Sep 18, 2009 at 4:18 PM, Mark Thomas <ma...@apache.org> wrote:
> Vinicius Carvalho wrote:
>> Hello there! I'm trying to redirect some legacy System.out calls in
>> our app to a different logger. Since tomcat's logging implementation
>> does not allow one to configure the maximum size of the catalina.out,
>> we are easily reaching gigabytes of space on that file.
>>
>> I thought that by just adding:
>>
>>  <Host name="localhost"  appBase="webapps"
>>             unpackWARs="true" autoDeploy="true"
>>             xmlValidation="false" xmlNamespaceAware="false"
>> swallowOutput="true">
>>
>> Would solve my problems, but, after re-starting the server and calling
>> a servlet that deliberate calls system.out, the catalina out gets all
>> the output
>
> Unsurprising, given that swallowOutput is not a valid attribute for a
> Host element. You want Context.
>
> Mark
>
>
>
>
> ---------------------------------------------------------------------
> 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: Yet another swallowOutput question

Posted by Mark Thomas <ma...@apache.org>.
Vinicius Carvalho wrote:
> Hello there! I'm trying to redirect some legacy System.out calls in
> our app to a different logger. Since tomcat's logging implementation
> does not allow one to configure the maximum size of the catalina.out,
> we are easily reaching gigabytes of space on that file.
> 
> I thought that by just adding:
> 
>  <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true"
>             xmlValidation="false" xmlNamespaceAware="false"
> swallowOutput="true">
> 
> Would solve my problems, but, after re-starting the server and calling
> a servlet that deliberate calls system.out, the catalina out gets all
> the output

Unsurprising, given that swallowOutput is not a valid attribute for a
Host element. You want Context.

Mark




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