You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brian Jones <bj...@uwo.ca> on 2011/10/20 19:59:01 UTC

Tomcat produces empty/missing log files

-          Environment: Windows 7 Professional, SP1 64-bit, Tomcat 5.5.33

-          Logging level set to INFO

-          CATALINA_OPTS: -Dsun.lang.ClassLoader.allowArraySyntax=true

-          No JAVA_OPTS environment variable

-          JAVA_HOME points to JDK 1.6.0_26

-          NOT installed as a Windows service. Tomcat starts/runs/stops fine
using startup.bat and shutdown.bat

-          Applications deploy properly, can be accessed and used properly

-          Tomcat admin console can be accessed and used properly

-          The problem is that the log files are always empty (0kb)

-          The following log files are produced by Tomcat, but are always
empty:

o   admin.date.log

o   catalina.date.log

o   host-manager.date.log

o   localhost.date.log

o   manager.date.log

-          The following log files are NOT produced by Tomcat (missing)

o   stdout.log

o   stderr.log

o   catalina.out

-          I’ve tried several workarounds to produce the log files properly,
all without success

o   Tried running the .bat file from the command line directly piping output
to a local .txt file; all that gets piped to the .txt file is the java
environment variables that are being used

o   Modified catalina.bat to pipe %EXECJAVA% … %ACTION% commands to log file
(didn’t work, nothing in the log file)

o   Followed instructions at
http://tomcat.apache.org/tomcat-5.5-doc/logging.html to set up logging

§  Tried log4j; log files didn’t contain exception messages

§  Tried commons logging; no change (log files still empty)

o   Followed the only previous mail-list item that seemed similar to my
situation: http://www.mail-archive.com/users@tomcat.apache.org/msg74244.html

§  Followed all responses; same result; this thread doesn’t seem to be
solved

§  (I do not receive VM instantiation errors like the user in that thread
does)

-          I can’t upgrade to a newer version of Tomcat because 5.5.33 is
the only version supported by the project I’m working on

 

Contents of logging.properties file (located in BOTH /common/classes/ and
/conf/ folders):

 

# Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements.  See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License.  You may obtain a copy of the License at

#

#     http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

 

handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler, 4admin.org.apache.juli.FileHandler,
5host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

 

.handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler

 

############################################################

# Handler specific properties.

# Describes specific configuration info for Handlers.

############################################################

 

1catalina.org.apache.juli.FileHandler.level = FINE

1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

1catalina.org.apache.juli.FileHandler.prefix = catalina.

 

2localhost.org.apache.juli.FileHandler.level = FINE

2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

2localhost.org.apache.juli.FileHandler.prefix = localhost.

 

3manager.org.apache.juli.FileHandler.level = FINE

3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

3manager.org.apache.juli.FileHandler.prefix = manager.

 

4admin.org.apache.juli.FileHandler.level = FINE

4admin.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

4admin.org.apache.juli.FileHandler.prefix = admin.

 

5host-manager.org.apache.juli.FileHandler.level = FINE

5host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

5host-manager.org.apache.juli.FileHandler.prefix = host-manager.

 

java.util.logging.ConsoleHandler.level = FINE

java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter

 

 

############################################################

# Facility specific properties.

# Provides extra control for each logger.

############################################################

 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
2localhost.org.apache.juli.FileHandler

 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].lev
el = INFO

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].han
dlers = 3manager.org.apache.juli.FileHandler

 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].level
= INFO

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].handl
ers = 4admin.org.apache.juli.FileHandler

 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager
].level = INFO

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager
].handlers = 5host-manager.org.apache.juli.FileHandler

 

# For example, set the com.xyz.foo logger to only log SEVERE

# messages:

#org.apache.catalina.startup.ContextConfig.level = FINE

#org.apache.catalina.startup.HostConfig.level = FINE

#org.apache.catalina.session.ManagerBase.level = FINE

 

Can anyone out there point me in the right direction? This is critical, as I
need the stack traces for exceptions, but the buffer in the command prompt
window is tiny, so they get flushed out easily.

 

Thanks in advance,

 

Brian J.

 


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
Please find below the context of logging.properties (updated, the 'verbose'
copy, rather than the minimalized copy you had suggested previously):

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler, 4admin.org.apache.juli.FileHandler,
5host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

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

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

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

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

5host-manager.org.apache.juli.FileHandler.level = FINE
5host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5host-manager.org.apache.juli.FileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
1catalina.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].lev
el = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].han
dlers = 3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].level
= INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].handl
ers = 4admin.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager
].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager
].handlers = 5host-manager.org.apache.juli.FileHandler

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.session.ManagerBase.level = FINE


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


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
The verbose file I was referring to was the original content of the
logging.properties file that I pasted in the previous message.

Brian J.


-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Friday, October 21, 2011 2:24 PM
To: Tomcat Users List
Subject: Re: Tomcat produces empty/missing log files

2011/10/21 Brian Jones <bj...@uwo.ca>:
>
>        It would be nice to see the actual command line that starts
Tomcat's
> Bootstrap. The JVM keys that configure  java.util.logging should be there.
>
> - I don't know what you mean by this.
>

I mean catalina.bat purpose is to prepare and call "java.exe". I'd
like to see the real command line that starts "java.exe".


> o   Followed instructions at
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html to set up logging
>
>        Maybe 7.0 docs will be more understandable.
>
> - 7.0 docs are not applicable, as I'm dealing with v5.5.33, and cannot
> upgrade to newer versions of Tomcat because 5.5.33 is the only version
> supported by the software project I'm working on (as stated in previous
> message)

Have you tried reading them? I spent good time trying to improve those
docs, to better explain what is going on, but wouldn't backport those
to 5.5.x


>
> - Yes, restored to original configuration. If I remove the log4j-x.x.x.jar
> file, it will then throw multiple exceptions like
> "java.lang.NoClassDefFoundError: org/apache/log4j/Priority" while starting
> Tomcat

??? What throws it?
There should be a stacktrace.


Maybe you shall start with a fresh copy of 5.5.33?

>
> o  Contents of logging.properties file (located in BOTH /common/classes/
and
> /conf/ folders):
>
>        It should be only in conf.
>
> - The instructions at http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> clearly state that the file is "to be placed in common/classes".

Huh. The doc is wrong there.

The file in common/classes will take priority over the one in conf,
but I'd say that that is an unusual configuration.

> Even so, I
> removed it from that directory, but get the same result
>
>        "Try to simplify your configuration.":
>
> - following your instructions I simplified the logging.properties file to
> the 1 entry you suggested. This produced some confusing results. The log
> file now contains MOST of the output; some exceptions found in the log;
the
> console was empty, but one exception was logged in the console and not in
> the log file.

Which one?

> Ideally (and what I think is normal behavior for Tomcat) it
> should be putting all output to the console, and duplicating all output to
> the log file.

In production you wouldn't want that output on console. It is harder
to rotate catalina.out.

>
> - I then did another experiment, keeping the more verbose
logging.properties
> file, and adding the following:
>
>        org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
> = INFO
>
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
> 1catalina.org.apache.juli.FileHandler
>
> - With this change, I can see all output in the console, and I can see
that
> it's now putting some of the output in two different files,
> catalina.date.log and localhost.date.log

http://www.catb.org/~esr/faqs/smart-questions.html

What is those "verbose logging.properties" and why those lines? You
are asking something, but are not providing facts. Do you expect
guesses as an answer?


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
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: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
Yes, but the dependencies are not managed locally, it's done using a remote
maven repository.
Thus, it would affect the entire community. No?

Brian J.


-----Original Message-----
From: David kerber [mailto:dckerber@verizon.net] 
Sent: Friday, October 21, 2011 4:26 PM
To: Tomcat Users List
Subject: Re: Tomcat produces empty/missing log files

On 10/21/2011 3:53 PM, Brian Jones wrote:
> Charles,
>
> Thanks for your reply.
>
> I'm not able to do as you suggested, because the software project is not
> managed by me, or my parent company. It is an open source enterprise
system
> that is managed by a community and a foundation.
>
> Also, it isn't just one project. The system I'm deploying is comprised of
> 100+ sub projects, that are all independent web apps which all interact
> together. Your suggestion would require me to go into 100+ projects to
make
> those changes. Even if I wanted to make those changes, then I would be
> working on a separate branch of the source, and would thusly isolate my
> development from the community's.

I doubt that, because you're not modifying any source code, just moving 
libraries around.


---------------------------------------------------------------------
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: Tomcat produces empty/missing log files

Posted by David kerber <dc...@verizon.net>.
On 10/21/2011 3:53 PM, Brian Jones wrote:
> Charles,
>
> Thanks for your reply.
>
> I'm not able to do as you suggested, because the software project is not
> managed by me, or my parent company. It is an open source enterprise system
> that is managed by a community and a foundation.
>
> Also, it isn't just one project. The system I'm deploying is comprised of
> 100+ sub projects, that are all independent web apps which all interact
> together. Your suggestion would require me to go into 100+ projects to make
> those changes. Even if I wanted to make those changes, then I would be
> working on a separate branch of the source, and would thusly isolate my
> development from the community's.

I doubt that, because you're not modifying any source code, just moving 
libraries around.


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


RE: Tomcat produces empty/missing log files

Posted by Daniel Mikusa <dm...@vmware.com>.
Brian,

If you can't put Log4j into WEB-INF/lib, could you try putting it into
"shared/lib"?  

I believe you mentioned that it was placed into "common/lib", which will
make it accessible to Tomcat & all of your webapps.  If you put it into
"shared/lib" it should only be accessible to your webapps, which should
hide it from Tomcat.

Dan



On Fri, 2011-10-21 at 12:53 -0700, Brian Jones wrote:
> Charles,
> 
> Thanks for your reply.
> 
> I'm not able to do as you suggested, because the software project is not
> managed by me, or my parent company. It is an open source enterprise system
> that is managed by a community and a foundation.
> 
> Also, it isn't just one project. The system I'm deploying is comprised of
> 100+ sub projects, that are all independent web apps which all interact
> together. Your suggestion would require me to go into 100+ projects to make
> those changes. Even if I wanted to make those changes, then I would be
> working on a separate branch of the source, and would thusly isolate my
> development from the community's.
> 
> Regards,
> 
> Brian J
> 
> 
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
> Sent: Friday, October 21, 2011 3:47 PM
> To: Tomcat Users List
> Subject: RE: Tomcat produces empty/missing log files
> 
> > From: Brian Jones [mailto:bjones86@uwo.ca] 
> > Subject: RE: Tomcat produces empty/missing log files
> 
> > Are there any known workarounds for using java.util.logging
> > instead of log4j even if the log4j.jar file is present?
> 
> If you only want log4j for a specific webapp rather than for Tomcat itself,
> put log4j.jar in WEB-INF/lib of the webapp, and the properties file in
> WEB-INF/classes.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you received
> this in error, please contact the sender and delete the e-mail and its
> attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> 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: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
Charles,

Thanks for your reply.

I'm not able to do as you suggested, because the software project is not
managed by me, or my parent company. It is an open source enterprise system
that is managed by a community and a foundation.

Also, it isn't just one project. The system I'm deploying is comprised of
100+ sub projects, that are all independent web apps which all interact
together. Your suggestion would require me to go into 100+ projects to make
those changes. Even if I wanted to make those changes, then I would be
working on a separate branch of the source, and would thusly isolate my
development from the community's.

Regards,

Brian J


-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Friday, October 21, 2011 3:47 PM
To: Tomcat Users List
Subject: RE: Tomcat produces empty/missing log files

> From: Brian Jones [mailto:bjones86@uwo.ca] 
> Subject: RE: Tomcat produces empty/missing log files

> Are there any known workarounds for using java.util.logging
> instead of log4j even if the log4j.jar file is present?

If you only want log4j for a specific webapp rather than for Tomcat itself,
put log4j.jar in WEB-INF/lib of the webapp, and the properties file in
WEB-INF/classes.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you received
this in error, please contact the sender and delete the e-mail and its
attachments from all computers.


---------------------------------------------------------------------
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: Tomcat produces empty/missing log files

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Brian Jones [mailto:bjones86@uwo.ca] 
> Subject: RE: Tomcat produces empty/missing log files

> Are there any known workarounds for using java.util.logging
> instead of log4j even if the log4j.jar file is present?

If you only want log4j for a specific webapp rather than for Tomcat itself, put log4j.jar in WEB-INF/lib of the webapp, and the properties file in WEB-INF/classes.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Tomcat produces empty/missing log files

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/21 Brian Jones <bj...@uwo.ca>:
>
> That defiantly makes sense. Are there any known workarounds for using
> java.util.logging instead of log4j even if the log4j.jar file is present?
>

You will need to read Commons Logging documentation for that.

http://wiki.apache.org/commons/How_to_Configure_the_Logging_Factory_and_the_Logging_Class

http://commons.apache.org/logging/apidocs/org/apache/commons/logging/package-summary.html#package_description

Apparently you will need to set up the following system property
before starting Tomcat
(e.g. in a bin/setenv.bat file):

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger

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


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
Konstantine and Mark,

Thanks to both of you for your revelations; without you two I would truly be
lost.

That defiantly makes sense. Are there any known workarounds for using
java.util.logging instead of log4j even if the log4j.jar file is present?

Thanks again for allowing me to pick your brain.

Brian J


-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Friday, October 21, 2011 3:40 PM
To: Tomcat Users List
Subject: Re: Tomcat produces empty/missing log files

2011/10/21 Brian Jones <bj...@uwo.ca>:
> Yes, it appears that the project I'm deploying is relying on log4j for
> logging; so when I remove the log4j.jar file, it obviously complains that
it
> can't find it.
>
> However, what I don't understand is why Tomcat refuses to log to the log
> files if there is a log4j.jar file present in the common/lib folder.
> Shouldn't it be looking for the log4j.properties file to determine if it
> uses log4j or commons?

That "commons" is a wrapper that autoselects either java.util.logging or
log4j

See http://commons.apache.org/logging/

logging.properties is configuration file for java.util.logging.


Dropping in log4j*.jar is enough to confuse the wrapper so that
effectively logging.properties is not used at all.

---------------------------------------------------------------------
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: Tomcat produces empty/missing log files

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/21 Brian Jones <bj...@uwo.ca>:
> Yes, it appears that the project I'm deploying is relying on log4j for
> logging; so when I remove the log4j.jar file, it obviously complains that it
> can't find it.
>
> However, what I don't understand is why Tomcat refuses to log to the log
> files if there is a log4j.jar file present in the common/lib folder.
> Shouldn't it be looking for the log4j.properties file to determine if it
> uses log4j or commons?

That "commons" is a wrapper that autoselects either java.util.logging or log4j

See http://commons.apache.org/logging/

logging.properties is configuration file for java.util.logging.


Dropping in log4j*.jar is enough to confuse the wrapper so that
effectively logging.properties is not used at all.

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


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
Yes, it appears that the project I'm deploying is relying on log4j for
logging; so when I remove the log4j.jar file, it obviously complains that it
can't find it.

However, what I don't understand is why Tomcat refuses to log to the log
files if there is a log4j.jar file present in the common/lib folder.
Shouldn't it be looking for the log4j.properties file to determine if it
uses log4j or commons? I verified that there is indeed no such
log4j.properties file, and the logging.properties file is in the correct
location.

The project I'm (attempting) to work on is a well known open source
enterprise LMS system. It is a very large system, comprised of 100+ sub
projects within the project itself. Building and dependencies are handled by
Maven. Not sure if that info helps with anything.

Thanks again,

Brian J.


-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Friday, October 21, 2011 3:31 PM
To: Tomcat Users List
Subject: Re: Tomcat produces empty/missing log files

On 21/10/2011 20:27, Brian Jones wrote:
> My mistake. The distro doesn't include the .jar by default. The project I
> deploy to Tomcat automatically sticks the log4j.jar file there.
> 
> Sorry for the confusion; I overlooked this step.

That begs the question "What else is it doing?" since it appears to be
breaking the Tomcat logging configuration.

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: Tomcat produces empty/missing log files

Posted by Mark Thomas <ma...@apache.org>.
On 21/10/2011 20:27, Brian Jones wrote:
> My mistake. The distro doesn't include the .jar by default. The project I
> deploy to Tomcat automatically sticks the log4j.jar file there.
> 
> Sorry for the confusion; I overlooked this step.

That begs the question "What else is it doing?" since it appears to be
breaking the Tomcat logging configuration.

Mark

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


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
My mistake. The distro doesn't include the .jar by default. The project I
deploy to Tomcat automatically sticks the log4j.jar file there.

Sorry for the confusion; I overlooked this step.

Brian J


-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Friday, October 21, 2011 3:23 PM
To: Tomcat Users List
Subject: Re: Tomcat produces empty/missing log files

On 21/10/2011 20:18, Brian Jones wrote:
> Thanks again for your insight into the problem.
> 
> Following your advice, I started from a fresh install of Tomcat 5.5.33.
> I noticed that log4j.1.2.16.jar is included in the common/lib folder by
> default.

No it isn't. Where are you getting this Tomcat distribution from?

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: Tomcat produces empty/missing log files

Posted by Mark Thomas <ma...@apache.org>.
On 21/10/2011 20:18, Brian Jones wrote:
> Thanks again for your insight into the problem.
> 
> Following your advice, I started from a fresh install of Tomcat 5.5.33.
> I noticed that log4j.1.2.16.jar is included in the common/lib folder by
> default.

No it isn't. Where are you getting this Tomcat distribution from?

Mark

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


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
Thanks again for your insight into the problem.

Following your advice, I started from a fresh install of Tomcat 5.5.33.
I noticed that log4j.1.2.16.jar is included in the common/lib folder by
default.

The only modification I made was the small addition to logging.properties:

	org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
= INFO
	
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
1catalina.org.apache.juli.FileHandler

I experienced the same results:
	- on first run, everything is fine but logs are empty.
	- second run I removed the log4j jar file
	- Tomcat now produces the output in the log files, but now complains
several times about ClassDefNotFound for log4j

Cheers,

Brian J.


-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Friday, October 21, 2011 2:24 PM
To: Tomcat Users List
Subject: Re: Tomcat produces empty/missing log files

2011/10/21 Brian Jones <bj...@uwo.ca>:
>
>        It would be nice to see the actual command line that starts
Tomcat's
> Bootstrap. The JVM keys that configure  java.util.logging should be there.
>
> - I don't know what you mean by this.
>

I mean catalina.bat purpose is to prepare and call "java.exe". I'd
like to see the real command line that starts "java.exe".


> o   Followed instructions at
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html to set up logging
>
>        Maybe 7.0 docs will be more understandable.
>
> - 7.0 docs are not applicable, as I'm dealing with v5.5.33, and cannot
> upgrade to newer versions of Tomcat because 5.5.33 is the only version
> supported by the software project I'm working on (as stated in previous
> message)

Have you tried reading them? I spent good time trying to improve those
docs, to better explain what is going on, but wouldn't backport those
to 5.5.x


>
> - Yes, restored to original configuration. If I remove the log4j-x.x.x.jar
> file, it will then throw multiple exceptions like
> "java.lang.NoClassDefFoundError: org/apache/log4j/Priority" while starting
> Tomcat

??? What throws it?
There should be a stacktrace.


Maybe you shall start with a fresh copy of 5.5.33?

>
> o  Contents of logging.properties file (located in BOTH /common/classes/
and
> /conf/ folders):
>
>        It should be only in conf.
>
> - The instructions at http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> clearly state that the file is "to be placed in common/classes".

Huh. The doc is wrong there.

The file in common/classes will take priority over the one in conf,
but I'd say that that is an unusual configuration.

> Even so, I
> removed it from that directory, but get the same result
>
>        "Try to simplify your configuration.":
>
> - following your instructions I simplified the logging.properties file to
> the 1 entry you suggested. This produced some confusing results. The log
> file now contains MOST of the output; some exceptions found in the log;
the
> console was empty, but one exception was logged in the console and not in
> the log file.

Which one?

> Ideally (and what I think is normal behavior for Tomcat) it
> should be putting all output to the console, and duplicating all output to
> the log file.

In production you wouldn't want that output on console. It is harder
to rotate catalina.out.

>
> - I then did another experiment, keeping the more verbose
logging.properties
> file, and adding the following:
>
>        org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
> = INFO
>
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
> 1catalina.org.apache.juli.FileHandler
>
> - With this change, I can see all output in the console, and I can see
that
> it's now putting some of the output in two different files,
> catalina.date.log and localhost.date.log

http://www.catb.org/~esr/faqs/smart-questions.html

What is those "verbose logging.properties" and why those lines? You
are asking something, but are not providing facts. Do you expect
guesses as an answer?


Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
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: Tomcat produces empty/missing log files

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/21 Brian Jones <bj...@uwo.ca>:
>
>        It would be nice to see the actual command line that starts Tomcat's
> Bootstrap. The JVM keys that configure  java.util.logging should be there.
>
> - I don't know what you mean by this.
>

I mean catalina.bat purpose is to prepare and call "java.exe". I'd
like to see the real command line that starts "java.exe".


> o   Followed instructions at
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html to set up logging
>
>        Maybe 7.0 docs will be more understandable.
>
> - 7.0 docs are not applicable, as I'm dealing with v5.5.33, and cannot
> upgrade to newer versions of Tomcat because 5.5.33 is the only version
> supported by the software project I'm working on (as stated in previous
> message)

Have you tried reading them? I spent good time trying to improve those
docs, to better explain what is going on, but wouldn't backport those
to 5.5.x


>
> - Yes, restored to original configuration. If I remove the log4j-x.x.x.jar
> file, it will then throw multiple exceptions like
> "java.lang.NoClassDefFoundError: org/apache/log4j/Priority" while starting
> Tomcat

??? What throws it?
There should be a stacktrace.


Maybe you shall start with a fresh copy of 5.5.33?

>
> o  Contents of logging.properties file (located in BOTH /common/classes/ and
> /conf/ folders):
>
>        It should be only in conf.
>
> - The instructions at http://tomcat.apache.org/tomcat-5.5-doc/logging.html
> clearly state that the file is "to be placed in common/classes".

Huh. The doc is wrong there.

The file in common/classes will take priority over the one in conf,
but I'd say that that is an unusual configuration.

> Even so, I
> removed it from that directory, but get the same result
>
>        "Try to simplify your configuration.":
>
> - following your instructions I simplified the logging.properties file to
> the 1 entry you suggested. This produced some confusing results. The log
> file now contains MOST of the output; some exceptions found in the log; the
> console was empty, but one exception was logged in the console and not in
> the log file.

Which one?

> Ideally (and what I think is normal behavior for Tomcat) it
> should be putting all output to the console, and duplicating all output to
> the log file.

In production you wouldn't want that output on console. It is harder
to rotate catalina.out.

>
> - I then did another experiment, keeping the more verbose logging.properties
> file, and adding the following:
>
>        org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
> = INFO
>
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
> 1catalina.org.apache.juli.FileHandler
>
> - With this change, I can see all output in the console, and I can see that
> it's now putting some of the output in two different files,
> catalina.date.log and localhost.date.log

http://www.catb.org/~esr/faqs/smart-questions.html

What is those "verbose logging.properties" and why those lines? You
are asking something, but are not providing facts. Do you expect
guesses as an answer?


Best regards,
Konstantin Kolinko

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


RE: Tomcat produces empty/missing log files

Posted by Brian Jones <bj...@uwo.ca>.
o   Tried running the .bat file from the command line directly piping output
to a local .txt file; all that gets piped to the .txt file is the java
environment variables that are being used

	startup.bat is equivalent to calling "catalina.bat start"

	Try using "catalina.bat run" instead.

- This command works, but then output is not seen on the console. I'm trying
to achieve normal funcationality, where the console displays all output, but
is DUPLICATED in the log file (which should normally be stdout.log or
catalina.out)

o   Modified catalina.bat to pipe %EXECJAVA% . %ACTION% commands to log file
(didn't work, nothing in the log file)

	It would be nice to see the actual command line that starts Tomcat's
Bootstrap. The JVM keys that configure 	java.util.logging should be there.

- I don't know what you mean by this.

o   Followed instructions at
http://tomcat.apache.org/tomcat-5.5-doc/logging.html to set up logging

	Maybe 7.0 docs will be more understandable.

- 7.0 docs are not applicable, as I'm dealing with v5.5.33, and cannot
upgrade to newer versions of Tomcat because 5.5.33 is the only version
supported by the software project I'm working on (as stated in previous
message)

o  Tried log4j; log files didn't contain exception messages

	Did you restore original configuration after these experiments? Did
you remove log4j.jar?

- Yes, restored to original configuration. If I remove the log4j-x.x.x.jar
file, it will then throw multiple exceptions like
"java.lang.NoClassDefFoundError: org/apache/log4j/Priority" while starting
Tomcat

o  Contents of logging.properties file (located in BOTH /common/classes/ and
/conf/ folders):

	It should be only in conf.

- The instructions at http://tomcat.apache.org/tomcat-5.5-doc/logging.html
clearly state that the file is "to be placed in common/classes". Even so, I
removed it from that directory, but get the same result

	"Try to simplify your configuration.":

- following your instructions I simplified the logging.properties file to
the 1 entry you suggested. This produced some confusing results. The log
file now contains MOST of the output; some exceptions found in the log; the
console was empty, but one exception was logged in the console and not in
the log file. Ideally (and what I think is normal behavior for Tomcat) it
should be putting all output to the console, and duplicating all output to
the log file.

- I then did another experiment, keeping the more verbose logging.properties
file, and adding the following:

	org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
= INFO
	
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers =
1catalina.org.apache.juli.FileHandler

- With this change, I can see all output in the console, and I can see that
it's now putting some of the output in two different files,
catalina.date.log and localhost.date.log
- At this point, I'm just confused as to what and why certain output is
being put in one file versus the other
- And it's still throwing exceptions about not being able to find log4j
- Using the above addition to the more verbose logging.properties file and
KEEPING the log4j.jar file in the common/lib folder produces some more
confusion
	- All output is shown in the console, there are no log4j exceptions
thrown, but the log files are empty again.

Any more ideas? It seems like the modification to the logging.properties
file was very close to achieving the goal, if only it didn't keep throwing
exceptions about log4j.

Thanks again,

Brian J.


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


Re: Tomcat produces empty/missing log files

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/20 Brian Jones <bj...@uwo.ca>:
> -          Environment: Windows 7 Professional, SP1 64-bit, Tomcat 5.5.33
>
> -          Logging level set to INFO
>
> -          CATALINA_OPTS: -Dsun.lang.ClassLoader.allowArraySyntax=true
>
> -          No JAVA_OPTS environment variable
>
> -          JAVA_HOME points to JDK 1.6.0_26
>
> -          NOT installed as a Windows service. Tomcat starts/runs/stops fine
> using startup.bat and shutdown.bat
>
> -          Applications deploy properly, can be accessed and used properly
>
> -          Tomcat admin console can be accessed and used properly
>
> -          The problem is that the log files are always empty (0kb)
>
> -          The following log files are produced by Tomcat, but are always
> empty:
>
> o   admin.date.log
>
> o   catalina.date.log
>
> o   host-manager.date.log
>
> o   localhost.date.log
>
> o   manager.date.log
>
> -          The following log files are NOT produced by Tomcat (missing)
>
> o   stdout.log
>
> o   stderr.log
>
> o   catalina.out
>
> -          I’ve tried several workarounds to produce the log files properly,
> all without success
>
> o   Tried running the .bat file from the command line directly piping output
> to a local .txt file; all that gets piped to the .txt file is the java
> environment variables that are being used

startup.bat is equivalent to calling "catalina.bat start"

Try using "catalina.bat run" instead.

>
> o   Modified catalina.bat to pipe %EXECJAVA% … %ACTION% commands to log file
> (didn’t work, nothing in the log file)

It would be nice to see the actual command line that starts Tomcat's Bootstrap.
The JVM keys that configure java.util.logging should be there.

> o   Followed instructions at
> http://tomcat.apache.org/tomcat-5.5-doc/logging.html to set up logging

Maybe 7.0 docs will be more understandable.


> §  Tried log4j; log files didn’t contain exception messages

Did you restore original configuration after these experiments? Did
you remove log4j.jar?

>(...)
> Contents of logging.properties file (located in BOTH /common/classes/ and
> /conf/ folders):

It should be only in conf.

> # Licensed to the Apache Software Foundation (ASF) under one or more
> (...)

Try to simplify your configuration.

Leave only "1catalina.org.apache.juli.FileHandler".

(You may include ConsoleHandler as well if you want to dup all to the
console as well, but omitting it you can catch what goes to console
only and not to the files).

[[[
handlers = 1catalina.org.apache.juli.FileHandler
.handlers = 1catalina.org.apache.juli.FileHandler

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

.level=INFO
]]]

IIRC If logging fails to start it prints a message to the console.


Best regards,
Konstantin Kolinko

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