I have a very strange error with my Tomcat. Server is not logging anymore. As you hear it, it just creates the log files (all of them), but they are empty. I'm sure there should be tons of information in there. And I don't mean catalina.out stuff and all, I mean ALL OF THEM, literally, webapps logs are also empty.
Just 10 days ago it was fine (Y2K11 problem maybe), I didn't touch any configuration, didn't deploy new applications, nothing.
As I say, the log files are created, but 0Kb is the size.
So, the first thing I did is checking permissions, they are fine.
The second thing was looking into logging.properties, here it is:
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
开发者_如何学C############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.FileHandler.level = FINE
#yeah, I have write permissions in that directory
1catalina.org.apache.juli.FileHandler.directory = /var/log/tomcat
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = /var/log/tomcat
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = /var/log/tomcat
3manager.org.apache.juli.FileHandler.prefix = manager.
4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = /var/log/tomcat
4host-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].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.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 = 4host-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
#org.apache.catalina.core.AprLifecycleListener.level=FINE
So, the next thing was trying to start the server directly by ./catalina.sh run. Bingo!!! All the logs files are written correctly, so I check ps -es | grep tomcat and compare to the output when I do /etc/init.d/tomcat start, it's identical, well, with some differences like -Xmx and stuff like that, but nothing relevant.
Then I see the generated logs, nothing new.
So, the question is, what more can I do to get my logs back? As of other things, Tomcat is working fine, I can see no anomalies with webapps deployed.
If Tomcat runs fine when launched via ./catalina.sh
and not when run via /etc/init.d/tomcat
then it stands to reason that the problem is some difference between the two cases. It could be due to:
- different command line options when launching the JVM
- different environment variables when the JVM is launched
- different current directory when the JVM is launched
- different effective user id when the JVM is launched.
You say that nothing has changed. But something definitely HAS changed ... if it was really working before.
OK, thanks to all.
I'm out of disk space, because /var/log is on separate partition I didn't notice that.
But, anyhow, I don't realize why was it working when started via catalina.sh run.
Thanks again.
精彩评论