Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-18-2008
joshmoore joshmoore is offline
Registered User
 
Name: Josh Moore
Organization: Glencoe Software, Inc.
Project: OMERO, http://trac.openmicroscopy.org.uk/omero
 
Join Date: Feb 2007
Location: Germany
Posts: 59
Logging Java process with IceGrid

I'm having difficulty properly capturing the standard out of a Java process in IceGrid. I'm currently using log4j via commons-logging.

When I run "java -jar blitz.jar --Ice.Config=..." from the command line I get logging to standard out via the log4j ConsoleAppender.

When IceGrid starts my server, with :
Code:
IceGrid.Node.Output=var/log
Ice.StdOut=var/log/master.out
Ice.StdErr=var/log/master.err
then initially logging of my server goes to master.out until the communicator is started and then all output ceases. (Only exceptions logged by the Ice runtime are printed to Blitz-0.err.)

Removing Ice.StdOut and Ice.StdErr makes no difference.

Setting IceGrid.Node.RedirectErrToOut=1 makes no difference.

Removing IceGrid.Node.Output does did make a difference in that standard out from the Blitz server continues being sent to master.out.

How do I properly capture the output from the server process in var/log/Blitz-0.out?


First, the server template:
Code:
    <server-template id="BlitzTemplate">
      <parameter name="index"/>
      <parameter name="exe"  default="java"/>
      <parameter name="mx"   default="256"/>
      <parameter name="port" default="8787"/>
      <server id="Blitz-${index}" exe="${exe}" activation="always">
        <target name="debug">
          <option>-Xdebug</option>
          <option>-Xrunjdwp:server=y,transport=dt_socket,address=${port},suspend=n</option>
        </target>
        <option>-Xmx${mx}m</option>
        <option>-jar</option>
        <option>blitz/blitz.jar</option>
        <adapter name="BlitzAdapter" replica-group="BlitzAdapters" register-process="true" endpoints="tcp"/>
        <properties>
          <property name="Ice.ThreadPool.Client.Size" value="2"/>
          <property name="Ice.ThreadPool.Client.SizeMax" value="50"/>
          <property name="Ice.ThreadPool.Server.Size" value="10"/>
          <property name="Ice.ThreadPool.Server.SizeMax" value="100"/>
        </properties>
      </server>
    </server-template>
Then the node configuration:
Code:
# Registry properties
IceGrid.Registry.Client.Endpoints=tcp -p 4061
IceGrid.Registry.Server.Endpoints=tcp
IceGrid.Registry.Internal.Endpoints=tcp
IceGrid.Registry.SessionManager.Endpoints=tcp
IceGrid.Registry.Data=var/registry
IceGrid.Registry.AdminPermissionsVerifier=IceGrid/NullPermissionsVerifier

# Node properties
IceGrid.Node.Endpoints=tcp
IceGrid.Node.Name=master
IceGrid.Node.Data=var/master
IceGrid.Node.Output=var/log
IceGrid.Node.CollocateRegistry=1
#IceGrid.Node.RedirectErrToOut=1

Ice.StdOut=var/log/master.out
Ice.StdErr=var/log/master.err
The generated server config:
Code:
# Configuration file (02/18/08 10:43:30.849)

# Server configuration
Ice.ServerId=Blitz-0
Ice.ProgramName=Blitz-0
# Object adapter BlitzAdapter
BlitzAdapter.Endpoints=tcp
BlitzAdapter.AdapterId=Blitz-0.BlitzAdapter
BlitzAdapter.ReplicaGroupId=BlitzAdapters
BlitzAdapter.RegisterProcess=1
# Server descriptor properties
Ice.ThreadPool.Client.Size=2
Ice.ThreadPool.Client.SizeMax=50
Ice.ThreadPool.Server.Size=10
Ice.ThreadPool.Server.SizeMax=100
Ice.StdErr=var/log/Blitz-0.err
Ice.StdOut=var/log/Blitz-0.out
Ice.Default.Locator="IceGrid/Locator" :tcp -p 4061
Reply With Quote
  #2 (permalink)  
Old 02-18-2008
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,545
Hi Josh,

The Ice communicator redirects the standard output and error when the communicator is initialized. I suspect the log4j output isn't correctly re-directed to the file when this occurs.

This is most likely because this log4j bug if you use an old log4j version or because you need to set the follow parameter to true in the log4j configuration (see also this link).

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 02-18-2008
joshmoore joshmoore is offline
Registered User
 
Name: Josh Moore
Organization: Glencoe Software, Inc.
Project: OMERO, http://trac.openmicroscopy.org.uk/omero
 
Join Date: Feb 2007
Location: Germany
Posts: 59
Thanks, Benoit.

Understood. "follow" did make all logging post-communicator creation log to the proper file.

My assumption was that icegridnode did the redirection, which lead to my confusion. This means there's no solution for (or perhaps better put it's not a bug that) the log output from before the Ice.Communicator creation goes to master.out whereas that after creation goes to Blitz-0.log.

If I'm wrong, please let me know, because it's important to have all the logging in a single file. If not possible, I will revert to not using "IceGrid.Node.Output" (and optionally setting Ice.StdOut/Ice.Stderr manually on the other servers).

Thanks again.
~Josh
Reply With Quote
  #4 (permalink)  
Old 02-18-2008
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,545
That's correct, the IceGrid node doesn't take care of the re-direction but instead generates the Ice.StdErr/Ice.StdOut properties for the server if IceGrid.Node.Output is defined in the IceGrid node configuration.

Cheers,
Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread dump when Java server is stopped by IceGrid mefoster Bug Reports 1 01-29-2007 06:04 PM
Environment variables for java IceBoxin IceGrid Sameerrele Help Center 4 10-10-2006 06:24 PM
IceBox hosting java services in IceGrid Sameerrele Help Center 5 08-21-2006 11:56 AM
Icegrid java icebox service xdm Help Center 6 01-09-2006 04:59 AM
starting "ice" process (node/admin etc) via Java BobDeAnna Help Center 6 01-04-2005 10:26 AM


All times are GMT -4. The time now is 01:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.