• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

In tomcat6, System.err.println or System.out.println don't seem to work

 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
.AppInitializer
java.lang.NullPointerException
at dbMgr.dbUtils.dbGetMaxSessions(dbUtils.java:99)
at utils.AppInitializer.initAppInfo(AppInitializer.java:92)
at utils.AppInitializer.contextInitialized(AppInitializer.java:38)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:
3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
91)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:123)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.
java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:769)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553
)


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.

TIA,
anw
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suspect the default config is different.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you rolling your own logging? Log4J and/or Commons Logging is a snap to use.
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

Thanks for the help!
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P. S.

I've also tried adding to the <Context> tag.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any more suggestions? I still haven't gotten this to work.
 
Allen Williams
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
New data point: when I set the handler in my logging.properties file thusly,

I get 0 bytes in the info-dev log (which used to have the aforementioned expception in it). Where is my console going?
 
reply
    Bookmark Topic Watch Topic
  • New Topic