VMware vSphere

 View Only
  • 1.  Checking log of a Java Application running as Windows Service

    Posted Oct 26, 2007 11:54 AM
    Not sure if this is possible - I have a small java application running as a service on windows. The java application has its own log file.

    Using Hyperic HQ I can monitor the Windows Service to check for availability but I also want to monitor the applications log file for any errors. For a windows service, under the Inventory tab, you can set Configuration properties to track a log - but you cannot specify the location of a log?

    I have also tried to add the location of the log to the Configuration properties of the defined windows Platform - platform.log_track.eventlogs - but Hyperic will not accept any value I enter here. It starts with the value 'System,Application' to monitor the system logs, but when I change this to 'System,Application,C:\test\XMIBuilder.log' i get the error - 'The configuration has not been set for this resource due to : Unable to modify config track config: Agent error: Event Log 'C:\test\XMIBuilder.log' does not exist' - when the file does exist.

    What I'm asking is:
    (1) Is what I want to do possible?
    (2) If yes am i missing how to do this or have i just made a mistake in one of the ways I was trying to do it above?

    Thanks for any help.
    Al.


  • 2.  RE: Checking log of a Java Application running as Windows Service

    Posted Oct 30, 2007 09:10 PM
    On a Windows box, when you set the log tracking facility, use of the Event Log system is assumed. From your description, it sounds as if you are trying to monitor a flat file that resides somewhere in the file system. If this is true, you will want to use the Fileserver File platform service type. Once added, specify the path to the file, and check the box for enabling log tracking. This should get you the desired result.


  • 3.  RE: Checking log of a Java Application running as Windows Service

    Posted Nov 02, 2007 04:06 PM
    Chip,

    Thanks for the answer. It seems to get me part of the way there - once I set up a FileServer File platform service, check the monitor log files options and specify my log file, it does keep track of it.

    The remaining problem is that all events that are logged to the file are reported as errors in the Hyperic HQ Log tracking window. I set the configuration where I set the logging to checked and specificed the log file so that only ERROR log entries are monitored. But as shown below, all log entries seem to be captured.

    Is there any way so that only certain types of log message are recorded (and they appear in the correct tab in the log tracking window, i.e. yellow tab for warnings)?

    * [11/02/2007 03:58:38 PM] Log Message (C:\appdev\logfiletest\log\application.log): C:\appdev\logfiletest\log\application.log: 02 Nov 2007 15:57:46,425 WARN [Test Driver Thread] TestThread - This is a test WARN message!
    * [11/02/2007 03:58:38 PM] Log Message (C:\appdev\logfiletest\log\application.log): C:\appdev\logfiletest\log\application.log: 02 Nov 2007 15:57:56,425 ERROR [Test Driver Thread] TestThread - This is a test ERROR message!
    * [11/02/2007 03:58:38 PM] Log Message (C:\appdev\logfiletest\log\application.log): C:\appdev\logfiletest\log\application.log: 02 Nov 2007 15:58:06,425 FATAL [Test Driver Thread] TestThread - This is a test FATAL message!
    * [11/02/2007 03:58:38 PM] Log Message (C:\appdev\logfiletest\log\application.log): C:\appdev\logfiletest\log\application.log: 02 Nov 2007 15:58:16,425 DEBUG [Test Driver Thread] TestThread - This is a test DEBUG message!
    * [11/02/2007 03:58:38 PM] Log Message (C:\appdev\logfiletest\log\application.log): C:\appdev\logfiletest\log\application.log: 02 Nov 2007 15:58:26,425 INFO [Test Driver Thread] TestThread - This is a test INFO message!

    Thanks.
    Alastair.


  • 4.  RE: Checking log of a Java Application running as Windows Service

    Posted Nov 02, 2007 04:32 PM
    Unfortunately, for the log level filter to work as expected, the log must be fomatted in log4j format. Given you are working with a Java app, this might be something simple to change within the applicatin.

    You can also filter log content based on patterns with the service.log_track.include and/or the service.log_track.exclude parameters. Be cautious using this method, as an overly aggressive exclusion pattern can leave you without information you expect.

    You can also use pattern matching in configuring alerts that fire based on log tracking. This is usually the best place to filter your logs to insure your results match what you expect.


  • 5.  RE: Checking log of a Java Application running as Windows Service

    Posted Oct 16, 2009 11:56 PM
    Log4j has many formats, wich is the one ConversionPattern, that makes posible a good log tracking with hyperic ?

    Thanks.


  • 6.  RE: Checking log of a Java Application running as Windows Service

    Posted Nov 05, 2007 11:47 AM
    Chip,

    Thanks. Certainly using a combination of the service.log_track.include and/or the service.log_track.exclude parametersas well as pattern matching in alert configurations gets some way towards what I was looking for.

    The java service uses log4j to create the content in the log file being monitored. I changed the format of the logging message so it matches the format in the logger for the Hyperic HQ Server (shown below) - but everything is still getting logged as an error message, even if it is debug, info, etc?

    Is there anything else I can do?

    <appender name="MainAppender" class="org.apache.log4j.RollingFileAppender">
    <param name="File" value="log/application.log"/>
    <param name="Append" value="true"/>
    <param name="MaxFileSize" value="10MB" />
    <param name="MaxBackupIndex" value="5"/>
    <param name="DatePattern" value="'.'yyyy-MM-dd"/>
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
    </layout>
    </appender>


  • 7.  RE: Checking log of a Java Application running as Windows Service

    Posted Oct 16, 2009 11:55 PM
    I got the same problem with a java application, monitored as process.