Discussion:
[jboss-user] [Beginner's Corner] - How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
Tony Sabore
2013-01-17 02:25:10 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792474#792474

--------------------------------------------------------------
Hello All,

I am new to this forum and need your assistance. 


Our JBoss log file, "stderrwfc.log" keeps growing and its currently at 6GB. The log file is located in the following path: d:\jboss\bin\stderrwfc.log. If we don't do something we are going to be out of space on the server.


Where do I make this change so that log file doesn't grow anymore and how to do it? 


I'm looking into how to set the service to truncate that log back to zero when I restart the service. At the moment it is set to keep the log file and append on a restart.


We're close. If anyone know "log4j" configuration over there, that appears to be the key.

Any help would be greatly appericated.

Cheers
Steven    
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792474#792474]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 02:33:12 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792478#792478

--------------------------------------------------------------
I'm going to make a guess that you are running Linux, that you run JBoss AS as a service (which version are you running) and that the stderrwfc.log file is the redirected stdout or stderr file. That file is not governed by log4j, instead it is just redirected output. There is no way to limit the size of that file. Your options are to

a) occasionally restart the JBoss AS service and between the stop and start, either delete or move the file.

or

b) Change your service init script to not redirect stdout and stderr. You don't really need them, any console log output already appears in server.log, or you could easily replace the console log with a rotating file logger.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792478#792478]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Tony Sabore
2013-01-17 02:50:55 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792483#792483

--------------------------------------------------------------
This is running on a Windows 2008 R2 Server, not Linux.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792483#792483]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 02:53:46 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792484#792484

--------------------------------------------------------------
OK, then how is that log file defined? It is not one of the standard log files (the standard ones are boot.log and server.log).

You never mentioned if you are running JBoss AS as a service. (It is much easier to help you if you provide details...)
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792484#792484]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Tony Sabore
2013-01-17 02:58:36 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792486#792486

--------------------------------------------------------------
Yes, JBoss_wfc is running as a service under Local System.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792486#792486]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 03:02:28 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792488#792488

--------------------------------------------------------------
What version of JBoss AS?

What mechanism are you using to run JBoss AS as a service (this wiki page mentions several, are you using one of them or somthing else?)
https://community.jboss.org/docs/DOC-11932 https://community.jboss.org/wiki/RunJBossAsAServiceOnWindows

You never said how the log file is defined...

Once again, it is much easier to help you if you provide details.......
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792488#792488]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Tony Sabore
2013-01-17 03:25:21 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792492#792492

--------------------------------------------------------------
how can I tell how the log file is defined? Again, I apologize as I am new to JBoss.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792492#792492]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 05:06:32 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792502#792502

--------------------------------------------------------------
You might start by answering all of my other questions. Then I might have some clue of where to tell you to look.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792502#792502]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Anirban Pal
2013-01-17 07:09:24 UTC
Permalink
Anirban Pal [https://community.jboss.org/people/anirbanpal] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792511#792511

--------------------------------------------------------------
What version of the AS ? AS 7 or EAP 6 or GA 5? You can possibly tell us what command and configuration you are using to run JBoss...are you calling a run.bat or standalone.bat or domain.bat and would you be able to tell us if and whether(which) any configuration\standaloneXXX.xml file you are passing on the command line after the -c option. Once you tell us this we may be able to guide you!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792511#792511]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Tony Sabore
2013-01-17 14:52:39 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792619#792619

--------------------------------------------------------------
The STDERR log file has no definition in the log4j config.

I added the following to [D:\Kronos\jboss\server\wfc\conf\jboss-log4j.xml] to stop apache from filling the log with INFO messages:

   <category name="org.apache">
      <priority value="ERROR"/>
   </category>

The service was configured using [d:\Kronos\wfc\bin\jBossWinService.bat] to start the jboss service as:

D:/Kronos\deployments\release\wfp_staging\app_server\applications\wpk\bin\jbossService.exe -install %JBOSS_SERVICE_NAME% %JAVA_HOME%\jre\bin\server\jvm.dll -server %charset% -Doracle.jdbc.defaultNChar="true" -Doracle.jdbc.convertNcharLiterals=true %JVM_HEAP_SIZES% %JVM_PARAMS_FOR_64% -XX:+HeapDumpOnOutOfMemoryError -Dsun.lang.ClassLoader.allowArraySyntax=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.service.binding.set=ports-wfc-default -Djava.class.path=%JAVA_HOME%\lib\tools.jar;%JBOSS_HOME%\bin\run.jar %JVM_PARAMS_FOR_JMX% -start org.jboss.Main -params "-cwfc" "-b0.0.0.0" -stop org.jboss.Main -method systemExit -out %JBOSS_HOME%\bin\stdoutwfc.log -err %JBOSS_HOME%\bin\stderrwfc.log -current %JBOSS_HOME%\bin -%startup%

Thanks,
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792619#792619]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 15:05:00 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792622#792622

--------------------------------------------------------------
OK, I see the log files in the service installation command: -out %JBOSS_HOME%\bin\stdoutwfc.log -err %JBOSS_HOME%\bin\stderrwfc.log
So these are stdout and stderr outputs, they are not controlled by JBoss AS.

The question now is - what is JBossService.exe? (It's not part of the typical JBoss AS release where there is a jbosssvc.exe that is used to run the service.) If you look at its properties via Windows Explorer, what information is shown on the Details tab? It is JBossService.exe that giverns how the logs are written to and apparently it is appending to the logs rather than overwritting the logs. The question is whether JBossService.exe has an option to not append but to overwrite instead.

Of course one way to reset the files is to stop the service, remove the log files, and then start the service.

Another thing you could try is to remove the files from the service installation command line and reinstall the service. (Or many services put their options in the registry, you could loacte the options in the registry and remove them.)

Notice that those are the same options I provided in my first response...
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792622#792622]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Tony Sabore
2013-01-17 15:11:59 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792623#792623

--------------------------------------------------------------

--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792623#792623]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 15:48:40 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792635#792635

--------------------------------------------------------------
OK, went to their web site: http://forge.ow2.org/projects/javaservice/ http://forge.ow2.org/projects/javaservice/
No docs that I could see (you are welcome to look)
Downloading requires registration. No thanks. You are welcome to register with them and download the zip file and see it it contains any documentation.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792635#792635]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Tony Sabore
2013-01-17 15:57:10 UTC
Permalink
Tony Sabore [https://community.jboss.org/people/awara1] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792638#792638

--------------------------------------------------------------
I've deleted some of the standard rolling files to gain a bit of space.

I don't want to drop the service during business hours.

I tried something like "echo > stderrwfc.log" but could not execute it because the service had the file locked. Do you have any tools or admin tricks to truncate a file while it's open?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792638#792638]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Peter Johnson
2013-01-17 16:24:14 UTC
Permalink
Peter Johnson [https://community.jboss.org/people/peterj] created the discussion

"Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted"

To view the discussion, visit: https://community.jboss.org/message/792648#792648

--------------------------------------------------------------
I do not know of anything that can do that in Windows (or in Linux for that matter).

One thing you could do to reduce the rate at which those files grow is to disable the CONSOLE log. In the D:\jboss\server\wfc\conf\jboss-log4j.xml file, for the CONSOLE appended, set the Threshold value to "off" or to "error". Another option is to remove the CONSOLE appender (and all reference to in within the jboss-log4j.xml file) entirely.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/792648#792648]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Christopher Park
2013-07-26 14:34:11 UTC
Permalink
Christopher Park [https://community.jboss.org/people/ccfpark] created the discussion

"Re: truncate Jboss log file contents to 0 when restarted"

To view the discussion, visit: https://community.jboss.org/message/829999#829999

--------------------------------------------------------------
Here's what I did to address this:

Edit "D:\jdk\jre\lib\logging.properties" with the following settings:

* .level= WARNING
* java.util.logging.ConsoleHandler.level = WARNING

Now my stderrwfc.log hardly grows (only when there is an error or warning).  The previous settings were INFO and I would say about 99.999% of the entries in there were Info messages.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/829999#829999]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Loading...