Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j prints out undesired Struts messages

 
Jerry Lee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recently, we moved our Websphere Application Server from IBM OS/400 to Redhat Linux.

After the move, the Log4J prints out the messages of Struts framework that we never had before, shown at the bottom:

I am sure we didn't change the logging levels in log4j.properties.

My question is how we could stop Log4J to print the messages of Struts framework.

I googled it and I couldn't find the anwser. Thanks.

SystemOut O DEBUG (RequestUtils.java:1821) - Module name found: default
SystemOut O DEBUG (RequestProcessor.java:225) - Processing a 'GET' for path '/portal'
SystemOut O DEBUG (RequestUtils.java:764) - Looking for ActionForm bean instance in scope 'request' under attribute key 'loginForm'
SystemOut O DEBUG (RequestUtils.java:839) - Creating new ActionForm instance of type 'portalweb.forms.LoginForm'
SystemOut O DEBUG (RequestUtils.java:844) - --> portalweb.forms.LoginForm@28562856
SystemOut O DEBUG (RequestProcessor.java:372) - Storing ActionForm bean instance in scope 'request' under attribute key 'loginForm'
SystemOut O DEBUG (RequestProcessor.java:813) - Populating bean properties from this request
SystemOut O DEBUG (BeanUtils.java:792) - BeanUtils.populate(portalweb.forms.LoginForm@28562856, {})
SystemOut O DEBUG (RequestProcessor.java:940) - Validating input form properties
SystemOut O DEBUG (RequestProcessor.java:945) - No errors detected, accepting input
SystemOut O DEBUG (RequestProcessor.java:305) - Looking for Action instance for class portalweb.actions.PortalAction
SystemOut O DEBUG (RequestProcessor.java:315) - Returning existing Action instance
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just set the Struts logger level to some high level such as ERROR. Example:
 
Jerry Lee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works, but not an acceptable solution for my boss.

What if we want to see other logs at "debug" level?

Thanks anyway.

Originally posted by Merrill Higginson:
Just set the Struts logger level to some high level such as ERROR. Example:
 
Paul Clapham
Sheriff
Posts: 21152
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jerry Lee:
That works, but not an acceptable solution for my boss.

What if we want to see other logs at "debug" level?
Why, did you run into that problem when you tried it? To me it looks like it sets the logging level for Struts to ERROR and leaves other applications alone. But if you tried it and that isn't what it did, then correct me.
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jerry Lee:
Recently, we moved our Websphere Application Server from IBM OS/400 to Redhat Linux.

After the move, the Log4J prints out the messages of Struts framework that we never had before, shown at the bottom:

I am sure we didn't change the logging levels in log4j.properties.

My question is how we could stop Log4J to print the messages of Struts framework.

I googled it and I couldn't find the anwser. Thanks.

SystemOut O DEBUG (RequestUtils.java:1821) - Module name found: default
SystemOut O DEBUG (RequestProcessor.java:225) - Processing a 'GET' for path '/portal'
SystemOut O DEBUG (RequestUtils.java:764) - Looking for ActionForm bean instance in scope 'request' under attribute key 'loginForm'
SystemOut O DEBUG (RequestUtils.java:839) - Creating new ActionForm instance of type 'portalweb.forms.LoginForm'
SystemOut O DEBUG (RequestUtils.java:844) - --> portalweb.forms.LoginForm@28562856
SystemOut O DEBUG (RequestProcessor.java:372) - Storing ActionForm bean instance in scope 'request' under attribute key 'loginForm'
SystemOut O DEBUG (RequestProcessor.java:813) - Populating bean properties from this request
SystemOut O DEBUG (BeanUtils.java:792) - BeanUtils.populate(portalweb.forms.LoginForm@28562856, {})
SystemOut O DEBUG (RequestProcessor.java:940) - Validating input form properties
SystemOut O DEBUG (RequestProcessor.java:945) - No errors detected, accepting input
SystemOut O DEBUG (RequestProcessor.java:305) - Looking for Action instance for class portalweb.actions.PortalAction
SystemOut O DEBUG (RequestProcessor.java:315) - Returning existing Action instance


Websphere is evil. There is a file ws-commons-logging.jar in IBM/Websphere/6.0/lib directory. Try to put your log4j.properties file inside this archive on the very root.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The log4j.properties entry that I gave you will only set the logging level at "ERROR" for Struts, and will leave all other logging as it was.
 
Jerry Lee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry I didn't read it carefully. I thought you set it to "Error" at rootCategory.

We will give it a try and have you updated, but it takes a couple of days.

Thanks.


Originally posted by Merrill Higginson:
The log4j.properties entry that I gave you will only set the logging level at "ERROR" for Struts, and will leave all other logging as it was.
 
Jerry Lee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Merrill Higginson:
Just set the Struts logger level to some high level such as ERROR. Example:
<blockquote>code:
<pre name="code" class="core">log4j.org.apache.struts=ERROR, SomeAppender</pre>

</blockquote>

This works for us. The only thing is we added "logger" in between as follows:

log4j.logger.org.apache.struts=ERROR, SomeAppender

Thanks.
 
Jerry Lee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This works for us. The only thing is we added "logger" in between as follows:
log4j.logger.org.apache.struts=ERROR, SomeAppender Thanks.


We spent days researching the cause of the problem and couldn't find the answer.

As part of the move from IBM OS/400 to Redhat Linux, we also upgraded from Websphere Application Server 6.0 to 6.1.

My question is why we get these Struts logging msgs that we didn't have before?

Thanks.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know there were changes in the way logging was handled from 6.0 to 6.1, but I'm not sure exactly what they are. The link below has a good discussion of some of the issues, though.

http://www-128.ibm.com/developerworks/forums/thread.jspa?messageID=14045904
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic