aspose file tools*
The moose likes Struts and the fly likes log4j prints out undesired Struts messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "log4j prints out undesired Struts messages" Watch "log4j prints out undesired Struts messages" New topic
Author

log4j prints out undesired Struts messages

Jerry Lee
Greenhorn

Joined: Sep 09, 2004
Posts: 16
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

Joined: Feb 15, 2005
Posts: 4864
Just set the Struts logger level to some high level such as ERROR. Example:


Merrill
Consultant, Sima Solutions
Jerry Lee
Greenhorn

Joined: Sep 09, 2004
Posts: 16
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
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

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.
Stas Sokolov
Ranch Hand

Joined: Apr 13, 2004
Posts: 117

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.


Good luck for yourself.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Sep 09, 2004
Posts: 16
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

Joined: Sep 09, 2004
Posts: 16
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

Joined: Sep 09, 2004
Posts: 16

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

Joined: Feb 15, 2005
Posts: 4864
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: log4j prints out undesired Struts messages