I have java application which I am running on Unix from the command prompt.
I am redirecting stdout and stderr to console.out and console.err files.
The file size is increasing because a lot of information is being logged.
I want to create a rolling file, when the file size increases above a particular size,
e.g console1.out should get created if console.out size exceeds 500KB.
Currently I am using
java MyAppName > logs/Console.out 2> logs/Console.err &
How can I do this?
Pipe the result to split like this:
java MyAppName | split -b500k - Console.logThis will create a new file every time you go over 500k. See the man-page for split for more details and options.