Results 1 to 4 of 4

Thread: Logging Java process with IceGrid

  1. #1
    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
    115

    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

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    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.

  3. #3
    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
    115
    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

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Logging all calls for IceGrid node servers
    By cfrauenberger in forum Help Center
    Replies: 4
    Last Post: 01-24-2011, 04:33 AM
  2. Replies: 5
    Last Post: 05-23-2009, 08:28 AM
  3. Logging in Python
    By Netmaster0000 in forum Help Center
    Replies: 6
    Last Post: 01-06-2009, 03:56 PM
  4. IceGrid server termination (stopServer) process
    By spsoni in forum Help Center
    Replies: 10
    Last Post: 05-12-2008, 03:33 AM
  5. starting "ice" process (node/admin etc) via Java
    By BobDeAnna in forum Help Center
    Replies: 6
    Last Post: 01-04-2005, 09:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •