awips2/javaUtilities/com.raytheon.uf.logsrv
Nate Jensen 8b9e688f96 Issue #2359 clean up log service for distribution, build everything
necessary into tar.gz file

Change-Id: I22a0b7d37694e523356c6f5ea0ad567bd6d32c15

Former-commit-id: 03ab1f9b8b [formerly 5aa4811368] [formerly c015cb1653] [formerly 03ab1f9b8b [formerly 5aa4811368] [formerly c015cb1653] [formerly be30d6c94e [formerly c015cb1653 [formerly 9bde0e7f917cde0bb4aeec6c92427729c007dabf]]]]
Former-commit-id: be30d6c94e
Former-commit-id: 28b408db85 [formerly 48171d03c2] [formerly 8ebfcb68cad8a0bc2b35528946a9fa0515aaf732 [formerly 2732368f17]]
Former-commit-id: 9e14c09009773ba4785a4149493109d2ad387731 [formerly e1ed0ed33d]
Former-commit-id: 5cf728a04f
2014-01-20 17:46:47 -06:00
..
.settings Issue #2359 initial checkin of remote log service 2013-09-12 11:50:16 -05:00
conf Issue #2359 clean up log service for distribution, build everything 2014-01-20 17:46:47 -06:00
META-INF Issue #2359 clean up log service for distribution, build everything 2014-01-20 17:46:47 -06:00
src/com/raytheon/uf/logsrv Issue #2359 clean up log service for distribution, build everything 2014-01-20 17:46:47 -06:00
.classpath Issue #2359 initial checkin of remote log service 2013-09-12 11:50:16 -05:00
.project Issue #2359 initial checkin of remote log service 2013-09-12 11:50:16 -05:00
build.properties Issue #2359 initial checkin of remote log service 2013-09-12 11:50:16 -05:00
build.xml Issue #2359 clean up log service for distribution, build everything 2014-01-20 17:46:47 -06:00
derby.log Issue #2359 initial checkin of remote log service 2013-09-12 11:50:16 -05:00
logsrv.sh Issue #2359 clean up log service for distribution, build everything 2014-01-20 17:46:47 -06:00
README.txt Issue #2359 clean up log service for distribution, build everything 2014-01-20 17:46:47 -06:00

##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
# 
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
# 
# Contractor Name:        Raytheon Company
# Contractor Address:     6825 Pine Street, Suite 340
#                         Mail Stop B8
#                         Omaha, NE 68106
#                         402.291.0100
# 
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##



Build instructions
-----------------------
In Eclipse run the build.xml by right clicking on the build.xml file and
running it.  That will produce a tar.gz with everything you need inside of it.


Install instructions
----------------------- 
Place the tar.gz file where you would like to install it, and run tar -xvf on
the tar.gz file.  Next go into the conf directory and modify config.xml to
 the best settings for your cluster.  Then open receiver.xml and go to the
 bottom of the file.  Edit the address to the name of the machine where
 you are installing the log service, and pick a port if you are not happy with
 the default.  Once your config settings are right, run the bin/logsrv.sh
 script to start the log service.
 
 At this point the log service is running but nothing is reporting to it.  You
 can configure any Java process using logback to report to it, but with the
 current version that is just EDEX and CAVE.  (Note technically you could
 configure AlertViz to report to the service too, but that is fairly pointless).
 
 To configure EDEX or CAVE to report to the log service, find the logback
 config files for those applications.  In EDEX they can typically be found at
 /awips2/edex/conf.  If you are not sure which logback file corresponds to
 which JVM, look at the shell scripts in /awips2/edex/etc.  If not explicitly
 stated in their corresponding shell script, then the JVMs use the logback file
 specified in default.sh.
 
 In CAVE the logback config files can typically be found at
 /awips2/cave/plugins/com.raytheon.uf.viz.core_${VERSION}.
 
 Once found, use a text editor to open the logback config file corresponding
 to the process you wish to report to the log service.  You need to add two
 things to the file, an appender and an appender-ref.
 
 Add an appender like the example below in the appenders section (generally
 towards the top of the file):
 
<appender class="ch.qos.logback.classic.net.SocketAppender" name="remoteLogSrv">
   <includeCallerData>false</includeCallerData>
   <port>5477</port>
   <remoteHost>dev33.oma.us.ray.com</remoteHost>
   <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
   <level>WARN</level>
   </filter>
</appender>
 
 Replace the remoteHost address with the machine where you installed the
 log service.  Note that you must have a network route between the two machines
 as it uses a socket to report the errors.  Replace the port with the port you chose
 in receiver.xml.  You can alter the threshold if need be.
 
 Next you must add your new remoteLogSrv appender to a logger.  Note that a
 logger can have multiple appenders.  For EDEX, the recommendation is to add
 it to the root logger.  For example:
 
<root>
   <level value="INFO"/>
   <appender-ref ref="asyncConsole"/>
   <appender-ref ref="remoteLogSrv"/>
</root>
 
 For CAVE, the recommendation is to add it to the CaveLogger.  For example:
 
<logger name="CaveLogger" additivity="false">
   <level value="ALL"/>
   <appender-ref ref="AsyncCaveLogAppender"/>
   <appender-ref ref="remoteLogSrv"/>
</logger>

Once you save the modified logback config file, you're done.  Logback will
automatically pick up a changed configuration within a minute or two, and
the Java processes you configured will start appending to the socket.


How it works
--------------
The log service is listening on the socket and will store the messages in a
derby database on the filesystem, and then at the scheduled time it will
attempt to analyze and consolidate the errors based on the information it has
available.  Then it will send an email using the configuration, reporting in an order
of what errors it thinks are most significant.

Note that it does not matter if the Java processes have the socket appender
configured but the log service is not running.  They will try to connect but then
go back to normal logging.  If the log service is running, they will resume sending
log messages through the socket.  Therefore, it does not hurt to have
everything configured even if the log service or the reporting processes are not
running.


Bugs and/or Improvements
--------------
If you encounter a bug with the log service or have an idea of how it can be
improved, send an email to nathan.jensen@raytheon.com.