-
1. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 16, 2013 9:33 PM (in response to awara1)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.
-
2. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
awara1 Jan 16, 2013 9:50 PM (in response to peterj)This is running on a Windows 2008 R2 Server, not Linux.
-
3. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 16, 2013 9:53 PM (in response to awara1)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...)
-
4. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
awara1 Jan 16, 2013 9:58 PM (in response to peterj)Yes, JBoss_wfc is running as a service under Local System.
-
5. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 16, 2013 10:02 PM (in response to awara1)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/wiki/RunJBossAsAServiceOnWindows
You never said how the log file is defined...
Once again, it is much easier to help you if you provide details.......
-
6. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
awara1 Jan 16, 2013 10:25 PM (in response to awara1)how can I tell how the log file is defined? Again, I apologize as I am new to JBoss.
-
7. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 17, 2013 12:06 AM (in response to awara1)You might start by answering all of my other questions. Then I might have some clue of where to tell you to look.
-
8. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
anirbanpal Jan 17, 2013 2:09 AM (in response to awara1)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!
-
9. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
awara1 Jan 17, 2013 10:22 AM (in response to anirbanpal)The STDERR log file has no definition in the log4j config.
I added the following to [D:\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:\wfc\bin\jBossWinService.bat] to start the jboss service as:
D:/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,
-
10. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 17, 2013 10:04 AM (in response to awara1)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...
-
11. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
awara1 Jan 17, 2013 10:16 AM (in response to peterj)Description
File description = JavaService
Type = Application
File version = 2.0.10.1
Product name = ObjectWeb Javaservice
Product version = 2,0,10,1
Copyright = (C) 2006 Multiplan Consultants Limited
Size = 136 KB
Date modified = 12/14/2011 5:36AM
Language = English (United Kingdom)
Original filename = JavaService.exe
-
12. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 17, 2013 10:48 AM (in response to awara1)OK, went to their web site: 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.
-
13. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
awara1 Jan 17, 2013 10:57 AM (in response to awara1)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?
-
14. Re: How to set the Jboss server to truncate the log file contents back to 0 when it is restarted
peterj Jan 17, 2013 11:24 AM (in response to awara1)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.