I know I'm bound to be doing something stupid. This is code I haven't worked on in about two years, then on tomcat 5, and I set up a brand new tomcat6 server and began to work on it again.
Note the log.write's in here, and the initDB, initAppInfo, etc.:
Here is log.write:
And, here's catalina*.log:
Aug 4, 2009 9:03:34 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Aug 4, 2009 9:03:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 753 ms
Aug 4, 2009 9:03:34 PM org.apache.catalina.users.MemoryUserDatabase save
WARNING: User database is not persistable - no write permissions on directory
Aug 4, 2009 9:03:34 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 4, 2009 9:03:34 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Aug 4, 2009 9:03:35 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class utils
at java.security.AccessController.doPrivileged(Native Method)
You can see that it got an exception in initAppInfo (third line into exception print), but none of the prior System.err.println or System.out.println's printed.
David Newton wrote:I'd suspect the default config is different.
Right. I've done a little more rooting around, and changed my logging.properties to this (info-dev is the hostname of the development computer I'm using):
So now I've got a separate info-dev log, which I guess is a good thing, but all it has in it is the prior-noted exceptions; it still doesn't have the println output. Is there any were else it could be configured, or could log files be stored elsewhere? This must be something trivial I'm missing. Does anything need to be configured in the server.xml or within the <Context> tags?
[ Why are you rolling your own logging? Log4J and/or Commons Logging is a snap to use.
I know, I know...but I just got the brand new version of tomcat up and running and went back to this code after two years, and this was the first thing that broke. I do feel like I need to understand what's going on, even if I redo the logging to be more standard. Is commons logging the same thing as java.util.logging?
No; Commons Logging is a wrapper API that provides a common interface for several underlying loggers, including Log4J, Java's logging, etc. (There are a few issues with it, but nothing that should be a problem for what you're doing there.)
If nothing else you could consider replacing the write() internals w/ a real logger--or just bite the bullet and do it right throughout. That said, I don't have an issue println-ing under TC6.
Replacing the guts of the write() method may be a way to go, but it is frustrating not to be able to figure out why the basic system calls won't work. I know it must be something trivial I'm missing. The main problem with "doing logging write" (pun intended) is that the whole web app uses it throughout.