Skip to main content

Glassfish 3.1 as a windows 7 service creates unmanaged stdout and stderr logs

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
17 replies [Last post]
dbritton60
Offline
Joined: 2009-12-18

When I install glassfish v3.1 as a windows service via
asadmin create-service --name name domain_name
two unmanaged logfiles are created in glassfisn3/glassfish/domains/domain_name/bin/, called servcieName.err.log and serviceName.out.log. These files are growing and are unmanaged. Is there a way to have them managed or to install glassfish v3.1 without them?
Regards,
David

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bnevins
Offline
Joined: 2005-03-28

Yes. We use winsw [1] for the low-level WIndows Service implementation. If you look here [2] you can see how the xml file in that directory is configured.
The default is to append to the file forever. You can also have it reset the files after every start by adding this line, [3], to the xml file.
Setting the logging mode to roll will automatically rename the logfiles' extension to old
[1] http://kenai.com/projects/winsw/
[2] http://kenai.com/projects/winsw/pages/ConfigurationSyntax

[3] <logmode>reset</logmode>
[4] <logmode>roll</logmode>
[5]<logpath>c:\some\dir</logpath>
dbritton60
Offline
Joined: 2009-12-18

bnevins,
Thanks for the response. I did find the xml file in my research. The problem is that the only management that takes place is on startup.
My problem is that I use some libraries to create some ejb that seem to be pretty verbose. After a few days of running, the service log files are very big. I have it resetting on glassfish startup. But the logs are still "unmanaged" during operation.
Is there a way to send the stdout or stderr to the bit bucket? Or, better yet, rolling logs with a max size and max number?
David

bnevins
Offline
Joined: 2005-03-28

Try

NUL
or
NUL:

On 5/18/2011 3:13 PM, forums@java.net wrote:
> bnevins,
>
> Thanks for the response. I did find the xml file in my research. The
> problem is that the only management that takes place is on startup.
>
> My problem is that I use some libraries to create some ejb that seem
> to be
> pretty verbose. After a few days of running, the service log files are
> very big. I have it resetting on glassfish startup. But the logs are
> still "unmanaged" during operation.
>
> Is there a way to send the stdout or stderr to the bit bucket? Or,
> better
> yet, rolling logs with a max size and max number?
>
> David
>
>
> --
>
> [Message sent by forum member 'dbritton60']
>
> View Post: http://forums.java.net/node/803324
>
>

--
Oracle
Byron Nevins | Principal MTS
Phone: +1 6503958992

Green Oracle Oracle is committed to
developing practices and products that help protect the environment

dbritton60
Offline
Joined: 2009-12-18

bnevins,
I tried both "NUL" and "NUL:" in the logpath field and the application server would not start. No logs were created (either stdout or stderr) nor were there any entries in the server.log. Trying to start the service with net start "service" resulted in "The service did not report an error". Any other thoughts?
:(
Dave

dbritton60
Offline
Joined: 2009-12-18

Okay, where?
are you talking about the <logpath> in the xml file?

bnevins
Offline
Joined: 2005-03-28

Yes
<logpath>NUL:</logpath>

dbritton60
Offline
Joined: 2009-12-18

bnevins,
I tried both "NUL" and "NUL:" in the logpath field and the application server would not start. No logs were created (either stdout or stderr) nor were there any entries in the server.log. Trying to start the service with net start "service" resulted in "The service did not report an error". Any other thoughts?
:(
Dave

bnevins
Offline
Joined: 2005-03-28

Try this
<logmode>rotate</logmode>
-- it will rotate the logfiles whenever they reach 10MB
(It wil keep at most 8 rotated files each in a round robin fashion)

dbritton60
Offline
Joined: 2009-12-18

Okay.
I had a service.err.log that was 1.2G in size. I changed the logmode from reset to rotate, and restarted the appliction server. The server started and was appending to the err.log (without truncating or rotating it). I then stopped the server, deleted the service.err.log file, and restarted. I will keep an eye on it and keep you posted.
I'm not sure I understand what to expect in "rotate" mode. How many log files of 10MB will the service maintain? Is the size and number configurable (like standard java logging)?

Dave

dbritton60
Offline
Joined: 2009-12-18

The service.err.log file has reached 36 M and growing. No rotation yet.
Dave

bnevins
Offline
Joined: 2005-03-28

It is supposed to rotate at 10MB. It keeps 8 such files. It is NOT configurable.
I learned this by inspecting the C# source code for the open-source tool we use, winsw
http://kenai.com/projects/winsw/pages/Home
===========
In your case this is all crazy. What we need in your case, and it is by no means uncommon probably, is a way to tell the server to not write ANYTHING to those log files. It is just a duplicate of what's going into the server log anyways.
Will you file a bug?

dbritton60
Offline
Joined: 2009-12-18

I created the bug report under the kenai project winsw.
However, I just noticed that thet proper logmode I should have tested is "roll" not "rotate". I have changed the mode and restarted the service and the first very large log file was rolled to ".old".
The log file has just grown over 10Mbytes. The "roll" mode must only be done on service start-up also :(

bnevins
Offline
Joined: 2005-03-28

Please see the issue:

http://java.net/jira/browse/GLASSFISH-16720

On 5/24/2011 6:30 AM, forums@java.net wrote:
> I created the bug report under the kenai project winsw.
>
> However, I just noticed that thet proper logmode I should have tested is
> "roll" not "rotate". I have changed the mode and restarted the
> service and
> the first very large log file was rolled to ".old".
>
> The log file has just grown over 10Mbytes. The "roll" mode must only be
> done on service start-up also :(
>
>
>
>
> --
>
> [Message sent by forum member 'dbritton60']
>
> View Post: http://forums.java.net/node/803324
>
>

--
Oracle
Byron Nevins | Principal MTS
Phone: +1 6503958992

Green Oracle Oracle is committed to
developing practices and products that help protect the environment

bnevins
Offline
Joined: 2005-03-28

Issue added to GlassFish for a permanent solution.
http://java.net/jira/browse/GLASSFISH-16720

bnevins
Offline
Joined: 2005-03-28

This is now fixed on the trunk (3.2)

Thanks for pointing out the problem!

dbritton60
Offline
Joined: 2009-12-18

I've tried using the new --watchdog switch on GF3.1.2 and asadmin reports it as invalid. When will we have access to it? As a workaround I've tried removing the --verbose switch. It stops the log files, but the service will not properly communicate to microsoft service control.

joy4all
Offline
Joined: 2013-08-09

May I know any solution on this issue ? I experience the same in the 3.1.2. The log files seems growing. I only manage to delete it by restart the services. I have tried --watchdog as well..but it doesn't work.