This cannot be done. The GC data is generated by the JVM (within the C/C++ code in which the JVM is written). There is no way to identify this data within a logging config file.
By the way, you should not have -verbose:gc or any of the other GC data generating options set constantly in production. You should use them only for load or performance testing. Setting them in production for a day or two is fine for gathering data to validate your performance testing results or to fine tune the performance. But after that you should turn those options off and use a monitoring tool to monitor the heap size, if that is really of concern.
You mean noone ever wrote an entry into log4j for GC.
I need temporary solution for the same.
Just searching for a method which can remove the first line.
Can't it be possible to remove the first line from log file without loosing the pipe.
Also, Look at this link.Someone do have faced such issues http://serverfault.com/questions/71341/why-do-jboss-and-logrotate-create-log-files-full-of-nul-characters
You can probably get rid of the ^@^@^@ by changing the code page used by the JVM, or change the localization setting. But that change would apply globally to the JVM and might adversly effect the apps running in the app server. I would just learn to live with the characters and realize that they are there. I would also look for an editor that will handle files with those characters.
The link you posted is in regards to the server.log file and has nothing ot do with the GC log.
Thanks for the response.
As I am newbie to Jboss, I maynot be able to understand what you said.
But What I tried is getting rid of the log.
cat /dev/null > gc.log
But seems that it wont work on data format (BINARY) file .
I tried with ASCII format file like /var/log/messages
and that worked !!!
Any idea how can we make it for data format file.
As you recommended, can you suggest me what changes I need to make.
I did tried with wtmp file which is again data format.
dd-command http://www.sunmanagers.org/archives/1995/0684.html as suggested.
But wonder how to put that for our environment.
"As I am newbie to Jboss,"
This discussion has nothing whatsoever to do with JBoss AS. This issue is entirely with the JVM. Are you a newbie to Java?
I have no idea why "cat /dev/null > xxx.log" does not clear out the log. I suspect you are doing this because you have logging turned on continuously in production. You should not be doing that, like I have already stated.
You can probably get rid of the ^@^@^@ by changing the code page used by the JVM, or change the localization setting.
Can you elaborate what you are trying to say with those lines.
I cant let those characters there .Why? Becuase everyday our support Team are deleting it manually as we have been receiving alerts through our tools.The size really goes up consuming more and more space.
So we cant let it be there.
One Quick Question:
I can see that when the log gets rotated it created gc_log.0 which is ASCII file while gc_log remains data file.
No idea why its behaving so. But thats what happening at our end.
Anyway We can take control and get rid of those logs.
Moving to "Installation, Configuration and Deployment" forum