Issue #951 added Appender EnvConfigurableRollingFileAppender.

Change-Id: Icfab60803c647afad6aa30e516083e46b27be75b

Former-commit-id: 4b383c3274 [formerly 4d103fe06c94b8d5067e44aaabfdac88347f9a96]
Former-commit-id: d10cabc917
This commit is contained in:
Brad Gonzales 2012-08-28 10:10:55 -05:00
parent c6bbd04898
commit 41dc92ba3a
23 changed files with 322 additions and 77 deletions

View file

@ -88,7 +88,8 @@ fi
while [ $exitVal -ne 0 ] while [ $exitVal -ne 0 ]
do do
curTime=`date +%Y%m%d_%H%M%S` curTime=`date +%Y%m%d_%H%M%S`
LOGFILE=${LOGDIR}/alertviz_${curTime}.log LOGFILE=${LOGDIR}/alertviz_${curTime}_console.log
export LOGFILE_ALERTVIZ=${LOGDIR}/alertviz_${curTime}_admin.log
#first check if we can write to the directory #first check if we can write to the directory
if [ -w ${LOGDIR} ]; then if [ -w ${LOGDIR} ]; then

View file

@ -116,7 +116,8 @@ fi
export pid=$$ export pid=$$
curTime=`date +%Y%m%d_%H%M%S` curTime=`date +%Y%m%d_%H%M%S`
LOGFILE=${LOGDIR}/cave_${curTime}_pid_${pid}.log LOGFILE=${LOGDIR}/cave_${curTime}_pid_${pid}_console.log
export LOGFILE_CAVE=${LOGDIR}/cave_${curTime}_pid_${pid}_alertviz.log
redirect="TRUE" redirect="TRUE"
for flag in $@; do for flag in $@; do

View file

@ -632,7 +632,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|| statMsg.getSourceKey().equals("GDN_ADMIN"); || statMsg.getSourceKey().equals("GDN_ADMIN");
if (isGdnAdminMessage) { if (isGdnAdminMessage) {
Container.logInternal(statMsg); // Container.logInternal(statMsg);
if ((statMsg.getDetails() != null) if ((statMsg.getDetails() != null)
&& (statMsg.getDetails().contains("Error") && (statMsg.getDetails().contains("Error")
|| statMsg.getDetails().contains("Exception") || statMsg.getDetails().contains("Exception")

View file

@ -29,3 +29,5 @@ Import-Package: com.raytheon.uf.common.python,
com.raytheon.uf.viz.python.swt, com.raytheon.uf.viz.python.swt,
com.raytheon.uf.viz.python.swt.widgets com.raytheon.uf.viz.python.swt.widgets
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: ext, registered, global
Eclipse-RegisterBuddy: org.apache.log4j

View file

@ -6,4 +6,5 @@ bin.includes = META-INF/,\
lib/derbyrun.jar,\ lib/derbyrun.jar,\
lib/derby.jar,\ lib/derby.jar,\
statusMessage.xsd,\ statusMessage.xsd,\
config.xml config.xml,\
log4j-alertviz.xml

View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- general application log -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG" />
<param name="levelMax" value="INFO" />
</filter>
</appender>
<appender name="errConsole" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err"/>
<param name="Threshold" value="WARN" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<appender name="AlertVizAdminLogAppender" class="com.raytheon.uf.viz.alertviz.EnvConfigurableRollingFileAppender">
<param name="envLogVar" value="LOGFILE_ALERTVIZ" />
<param name="maxFileSize" value="2GB"/>
<param name="maxBackupIndex" value="5"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] : %m%n"/>
</layout>
</appender>
<logger name="AlertVizAdminLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AlertVizAdminLogAppender"/>
</logger>
<logger name="com.raytheon">
<level value="INFO"/>
</logger>
<logger name="com.tc">
<level value="WARN"/>
</logger>
<logger name="mx4j">
<level value="ERROR"/>
</logger>
<logger name="org.apache">
<level value="INFO"/>
</logger>
<logger name="org.apache.activemq.spring">
<level value="WARN"/>
</logger>
<logger name="org.apache.commons.beanutils">
<level value="WARN"/>
</logger>
<logger name="org.apache.qpid">
<level value="WARN"/>
</logger>
<logger name="org.geotools">
<level value="WARN"/>
</logger>
<logger name="org.apache.xbean.spring">
<level value="WARN"/>
</logger>
<logger name="org.springframework">
<level value="ERROR"/>
</logger>
<logger name="uk.ltd.getahead">
<level value="WARN"/>
</logger>
<!-- default logging -->
<root>
<level value="INFO"/>
<appender-ref ref="console"/>
<appender-ref ref="errConsole"/>
</root>
</log4j:configuration>

View file

@ -230,7 +230,7 @@ public class AlertvizJob extends Job {
e); e);
StatusMessage sm = new StatusMessage(); StatusMessage sm = new StatusMessage();
sm.setPriority(Priority.CRITICAL); sm.setPriority(Priority.CRITICAL);
sm.setMachine("LOCAL"); sm.setMachineToCurrent();
sm.setCategory("GDN_ADMIN"); sm.setCategory("GDN_ADMIN");
sm.setSourceKey("GDN_ADMIN"); sm.setSourceKey("GDN_ADMIN");
sm.setMessage(e.getMessage()); sm.setMessage(e.getMessage());

View file

@ -36,7 +36,7 @@ import com.raytheon.uf.viz.alertviz.config.Category;
import com.raytheon.uf.viz.alertviz.config.Configuration; import com.raytheon.uf.viz.alertviz.config.Configuration;
import com.raytheon.uf.viz.alertviz.config.ForcedConfiguration; import com.raytheon.uf.viz.alertviz.config.ForcedConfiguration;
import com.raytheon.uf.viz.alertviz.config.Source; import com.raytheon.uf.viz.alertviz.config.Source;
import com.raytheon.uf.viz.alertviz.internal.ArchiveLogJob; import com.raytheon.uf.viz.alertviz.internal.PurgeLogJob;
import com.raytheon.uf.viz.alertviz.internal.LogMessageDAO; import com.raytheon.uf.viz.alertviz.internal.LogMessageDAO;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
@ -63,8 +63,8 @@ public class Container implements IConfigurationChangedListener {
public static final String SOURCE_MISSING = "Source was not found"; public static final String SOURCE_MISSING = "Source was not found";
private transient static final org.apache.log4j.Logger internalLogger = Logger private transient static final org.apache.log4j.Logger adminLogger = Logger
.getLogger("AlertVizLogger"); .getLogger("AlertVizAdminLogger");
private Configuration configuration; private Configuration configuration;
@ -96,7 +96,7 @@ public class Container implements IConfigurationChangedListener {
.getForcedConfiguration(); .getForcedConfiguration();
ConfigurationManager.getInstance().addListener(this); ConfigurationManager.getInstance().addListener(this);
this.callbacks = callbacks; this.callbacks = callbacks;
ArchiveLogJob archive = new ArchiveLogJob(); PurgeLogJob archive = new PurgeLogJob();
archive.schedule(); archive.schedule();
} }
@ -171,7 +171,7 @@ public class Container implements IConfigurationChangedListener {
// for now, just send to the regular log // for now, just send to the regular log
StatusMessage sm = new StatusMessage(); StatusMessage sm = new StatusMessage();
sm.setPriority(priority); sm.setPriority(priority);
sm.setMachine("LOCAL"); sm.setMachineToCurrent();
sm.setSourceKey("GDN_ADMIN"); sm.setSourceKey("GDN_ADMIN");
sm.setCategory("GDN)ADMIN"); sm.setCategory("GDN)ADMIN");
sm.setMessage(msg); sm.setMessage(msg);
@ -319,24 +319,25 @@ public class Container implements IConfigurationChangedListener {
String cat = message.getCategory(); String cat = message.getCategory();
String source = message.getSourceKey(); String source = message.getSourceKey();
if ((cat != null && cat.equalsIgnoreCase("GDN_ADMIN")) boolean isInternal = (cat != null && cat.equalsIgnoreCase("GDN_ADMIN"))
|| (source != null && source.equalsIgnoreCase("GDN_ADMIN"))) { || (source != null && source.equalsIgnoreCase("GDN_ADMIN"));
if (isInternal) {
switch (message.getPriority()) { switch (message.getPriority()) {
case CRITICAL: case CRITICAL:
internalLogger.fatal(message); adminLogger.fatal(message);
break; break;
case SIGNIFICANT: case SIGNIFICANT:
internalLogger.error(message); adminLogger.error(message);
break; break;
case PROBLEM: case PROBLEM:
internalLogger.warn(message); adminLogger.warn(message);
break; break;
case EVENTA: // fall through case EVENTA: // fall through
case EVENTB: case EVENTB:
internalLogger.info(message); adminLogger.info(message);
break; break;
case VERBOSE: case VERBOSE:
internalLogger.debug(message); adminLogger.debug(message);
break; break;
} }
} }

View file

@ -0,0 +1,80 @@
/**
* 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.
**/
package com.raytheon.uf.viz.alertviz;
import org.apache.log4j.RollingFileAppender;
import org.apache.log4j.helpers.LogLog;
/**
* RollingFileAppender retrieves the value set for property EnvLogVar from the
* system environment to define the log file.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 10, 2012 bgonzale Initial creation
*
* </pre>
*
* @author bgonzale
* @version 1.0
*/
public class EnvConfigurableRollingFileAppender extends RollingFileAppender {
private String envLogVar;
/**
* @param envLogVar
* the envLogVar to set
*/
public void setEnvLogVar(String envLogVar) {
this.envLogVar = envLogVar;
setFileFromEnv();
}
/**
* @return the envLogVar
*/
public String getEnvLogVar() {
return envLogVar;
}
private void setFileFromEnv() {
if (envLogVar == null || envLogVar.isEmpty()) {
LogLog.error("Appender [" + name
+ "] requires EnvLogVar to be set.");
} else {
String file = System.getenv(envLogVar);
if (file == null || file.isEmpty()) {
LogLog.error("Appender [" + name
+ "] needs environment variable, " + envLogVar
+ ", to be set.");
} else {
setFile(file);
}
}
}
}

View file

@ -19,6 +19,7 @@
**/ **/
package com.raytheon.uf.viz.alertviz; package com.raytheon.uf.viz.alertviz;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
@ -50,6 +51,9 @@ import com.raytheon.uf.viz.core.status.VizStatusInternal;
public class SystemStatusHandler extends AbstractStatusHandler { public class SystemStatusHandler extends AbstractStatusHandler {
private transient static final org.apache.log4j.Logger logger = Logger
.getLogger("CaveLogger");
private static final String WORKSTATION = "WORKSTATION"; private static final String WORKSTATION = "WORKSTATION";
/* /*
@ -66,14 +70,13 @@ public class SystemStatusHandler extends AbstractStatusHandler {
if (status instanceof VizStatusInternal) { if (status instanceof VizStatusInternal) {
VizStatusInternal vs = (VizStatusInternal) status; VizStatusInternal vs = (VizStatusInternal) status;
sm = new StatusMessage(vs.getSource(), vs.getCategory(), sm = vs.toStatusMessage();
vs.getPriority(), vs.getPluginName(), vs.getMessage(),
vs.getException());
} else { } else {
sm = from(status); sm = from(status);
} }
try { try {
logStatus(sm);
AlertVizClient.sendMessage(sm); AlertVizClient.sendMessage(sm);
} catch (final AlertvizException e) { } catch (final AlertvizException e) {
// not a good situation, since we can't communicate with the log // not a good situation, since we can't communicate with the log
@ -111,7 +114,7 @@ public class SystemStatusHandler extends AbstractStatusHandler {
StatusMessage sm = new StatusMessage(); StatusMessage sm = new StatusMessage();
sm.setCategory(WORKSTATION); sm.setCategory(WORKSTATION);
sm.setMachine("LOCAL"); sm.setMachineToCurrent();
switch (status.getSeverity()) { switch (status.getSeverity()) {
case Status.ERROR: case Status.ERROR:
sm.setPriority(Priority.SIGNIFICANT); sm.setPriority(Priority.SIGNIFICANT);
@ -184,4 +187,26 @@ public class SystemStatusHandler extends AbstractStatusHandler {
int count) throws AlertvizException { int count) throws AlertvizException {
return LogMessageDAO.getInstance().load(count, category); return LogMessageDAO.getInstance().load(count, category);
} }
private void logStatus(StatusMessage status) {
switch (status.getPriority()) {
case CRITICAL:
logger.fatal(status);
break;
case SIGNIFICANT:
logger.error(status);
break;
case PROBLEM:
logger.warn(status);
break;
case EVENTA: // fall through
case EVENTB:
logger.info(status);
break;
case VERBOSE:
logger.debug(status);
break;
}
}
} }

View file

@ -250,7 +250,7 @@ public class LogMessageDAO {
} }
public void save(StatusMessage sm) throws AlertvizException { public void save(StatusMessage sm) throws AlertvizException {
// Container.logInternal(sm); Container.logInternal(sm);
synchronized (this) { synchronized (this) {
boolean errorOccurred = false; boolean errorOccurred = false;
ResultSet rs = null; ResultSet rs = null;

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.uf.viz.alertviz.internal; package com.raytheon.uf.viz.alertviz.internal;
import java.io.File;
import java.sql.Timestamp; import java.sql.Timestamp;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -32,13 +31,9 @@ import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.alertviz.Activator; import com.raytheon.uf.viz.alertviz.Activator;
import com.raytheon.uf.viz.alertviz.AlertvizException; import com.raytheon.uf.viz.alertviz.AlertvizException;
import com.raytheon.uf.viz.alertviz.Constants; import com.raytheon.uf.viz.alertviz.Constants;
import com.raytheon.uf.viz.alertviz.LogUtil;
import com.raytheon.uf.viz.alertviz.LogUtil.Order;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
/** /**
* Purges the database, and archives the old log entries to a text file * Purges old database entries.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -50,26 +45,16 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* @author chammack * @author chammack
* @version 1.0 * @version 1.0
*/ */
public class ArchiveLogJob extends Job { public class PurgeLogJob extends Job {
private int numberOfLogsToKeep;
private int ageOfLogInHours; private int ageOfLogInHours;
private static final int DEFAULT_NUMBER_OF_LOGS = 10;
private static final int DEFAULT_AGE_OF_LOG_IN_HRS = 12; private static final int DEFAULT_AGE_OF_LOG_IN_HRS = 12;
private static final int MILLISECONDS_IN_HOUR = 60 * 60 * 1000; private static final int MILLISECONDS_IN_HOUR = 60 * 60 * 1000;
public ArchiveLogJob() { public PurgeLogJob() {
super("Archive Log"); super("Archive Log Purge");
this.setSystem(true);
numberOfLogsToKeep = Activator.getDefault().getPreferenceStore()
.getInt(Constants.P_NUMBER_OF_LOGS);
if (numberOfLogsToKeep == 0) {
this.numberOfLogsToKeep = DEFAULT_NUMBER_OF_LOGS;
}
ageOfLogInHours = Activator.getDefault().getPreferenceStore() ageOfLogInHours = Activator.getDefault().getPreferenceStore()
.getInt(Constants.P_MAX_AGE_OF_LOGS); .getInt(Constants.P_MAX_AGE_OF_LOGS);
@ -90,14 +75,8 @@ public class ArchiveLogJob extends Job {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
if ((now - lastPurgeInMs) > (ageOfLogInHours * MILLISECONDS_IN_HOUR)) { if ((now - lastPurgeInMs) > (ageOfLogInHours * MILLISECONDS_IN_HOUR)) {
String s = LocalizationManager.getUserDir() + "textLogs"
+ File.separator + VizApp.getHostName()
+ File.separator + "log";
LogUtil.rollLogs(s, numberOfLogsToKeep);
Timestamp ts = new Timestamp(now Timestamp ts = new Timestamp(now
- (ageOfLogInHours * MILLISECONDS_IN_HOUR)); - (ageOfLogInHours * MILLISECONDS_IN_HOUR));
LogUtil.saveLogToFile(new File(s + ".0"), ts, Order.BEFORE);
LogMessageDAO.getInstance().purge(ts); LogMessageDAO.getInstance().purge(ts);
} }
} catch (AlertvizException e) { } catch (AlertvizException e) {
@ -111,7 +90,7 @@ public class ArchiveLogJob extends Job {
.openError( .openError(
Display.getDefault().getActiveShell(), Display.getDefault().getActiveShell(),
"Error", "Error",
"Error rotating saving and rotating logs. Archived logs may not be stored", "Error purging logs.",
s); s);
} }

View file

@ -34,7 +34,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174" com.raytheon.uf.common.geospatial;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: ext, registered, global Eclipse-BuddyPolicy: ext, registered, global
Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level Eclipse-RegisterBuddy: org.apache.velocity, org.apache.log4j, com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level
Export-Package: com.raytheon.uf.viz.core, Export-Package: com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.alerts, com.raytheon.uf.viz.core.alerts,
com.raytheon.uf.viz.core.auth, com.raytheon.uf.viz.core.auth,

View file

@ -5,4 +5,5 @@ bin.includes = META-INF/,\
plugin.xml,\ plugin.xml,\
config.xml,\ config.xml,\
scriptTemplates/,\ scriptTemplates/,\
schema/ schema/,\
log4j-viz-core.xml

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG" />
<param name="levelMax" value="INFO" />
</filter>
</appender>
<appender name="errConsole" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err"/>
<param name="Threshold" value="WARN" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<appender name="CaveLogAppender" class="com.raytheon.uf.viz.alertviz.EnvConfigurableRollingFileAppender">
<param name="envLogVar" value="LOGFILE_CAVE" />
<param name="maxFileSize" value="2GB"/>
<param name="maxBackupIndex" value="5"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %m%n"/>
</layout>
</appender>
<appender name="AsyncCaveLogAppender" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="500"/>
<appender-ref ref="CaveLogAppender"/>
</appender>
<logger name="CaveLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncCaveLogAppender"/>
</logger>
<logger name="com.raytheon">
<level value="INFO"/>
</logger>
<logger name="com.tc">
<level value="WARN"/>
</logger>
<logger name="mx4j">
<level value="ERROR"/>
</logger>
<logger name="org.apache">
<level value="INFO"/>
</logger>
<logger name="org.apache.activemq.spring">
<level value="WARN"/>
</logger>
<logger name="org.apache.commons.beanutils">
<level value="WARN"/>
</logger>
<logger name="org.apache.qpid">
<level value="WARN"/>
</logger>
<logger name="org.geotools">
<level value="WARN"/>
</logger>
<logger name="org.apache.xbean.spring">
<level value="WARN"/>
</logger>
<logger name="org.springframework">
<level value="ERROR"/>
</logger>
<logger name="uk.ltd.getahead">
<level value="WARN"/>
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="console"/>
<appender-ref ref="errConsole"/>
</root>
</log4j:configuration>

View file

@ -88,8 +88,9 @@ public class VizStatusHandler implements IUFStatusHandler {
this.source = factory.getSource(source, pluginId); this.source = factory.getSource(source, pluginId);
} }
} }
StatusManager.getManager().handle( VizStatusInternal vizStatus = new VizStatusInternal(status, category,
new VizStatusInternal(status, category, source, pluginId)); source, pluginId);
StatusManager.getManager().handle(vizStatus);
} }
@Override @Override

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.core.status;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import com.raytheon.uf.common.message.StatusMessage;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
/** /**
@ -170,4 +171,9 @@ public class VizStatusInternal extends UFStatus implements IStatus {
return pluginName; return pluginName;
} }
public StatusMessage toStatusMessage() {
return new StatusMessage(this.source, this.category, this.priority,
this.pluginName, this.message, this.exception);
}
} }

View file

@ -20,12 +20,11 @@ Developed on the Raytheon Visualization Environment (viz)
<launcherArgs> <launcherArgs>
<programArgs>-data @user.home/caveData -user @user.home/caveData -clean</programArgs> <programArgs>-data @user.home/caveData -user @user.home/caveData -clean</programArgs>
<programArgsLin>-consoleLog</programArgsLin> <programArgsLin>-consoleLog</programArgsLin>
<vmArgs>-Xincgc -Xmx256M -Xss2024k -Dosgi.instance.area.readOnly=true -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler -Dorg.eclipse.update.reconcile=false -Dqpid.dest_syntax=BURL -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false</vmArgs> <vmArgs>-Xincgc -Xmx256M -Xss2024k -Dosgi.instance.area.readOnly=true -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler -Dorg.eclipse.update.reconcile=false -Dqpid.dest_syntax=BURL -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dlog4j.configuration=log4j-alertviz.xml</vmArgs>
</launcherArgs> </launcherArgs>
<windowImages/> <windowImages/>
<launcher name="alertviz"> <launcher name="alertviz">
<solaris/> <solaris/>
<win useIco="false"> <win useIco="false">
@ -39,7 +38,6 @@ Developed on the Raytheon Visualization Environment (viz)
</win> </win>
</launcher> </launcher>
<vm> <vm>
<linux include="true">jdk1.6.0</linux> <linux include="true">jdk1.6.0</linux>
<windows include="true">jdk1.6.0</windows> <windows include="true">jdk1.6.0</windows>

View file

@ -18,7 +18,7 @@
<programArgsLin>-consoleLog</programArgsLin> <programArgsLin>-consoleLog</programArgsLin>
<vmArgs>-Xincgc -Xmx1280M -Dosgi.instance.area.readOnly=true <vmArgs>-Xincgc -Xmx1280M -Dosgi.instance.area.readOnly=true
-Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler
-XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:OnOutOfMemoryError=&quot;capture -t no -p $pid &amp;&quot;</vmArgs> -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:OnOutOfMemoryError=&quot;capture -t no -p $pid &amp;&quot; -Dlog4j.configuration=log4j-viz-core.xml</vmArgs>
<vmArgsWin>-Dfile.encoding=UTF-8</vmArgsWin> <vmArgsWin>-Dfile.encoding=UTF-8</vmArgsWin>
</launcherArgs> </launcherArgs>

View file

@ -17,7 +17,7 @@
<programArgs>-data @user.home/caveData -user @user.home/caveData -clean -consoleLog -alertviz</programArgs> <programArgs>-data @user.home/caveData -user @user.home/caveData -clean -consoleLog -alertviz</programArgs>
<vmArgs>-Xincgc -Xmx1024M -Dosgi.instance.area.readOnly=true <vmArgs>-Xincgc -Xmx1024M -Dosgi.instance.area.readOnly=true
-Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler -Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler
-XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false</vmArgs> -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dlog4j.configuration=log4j-viz-core.xml</vmArgs>
<vmArgsWin>-Dfile.encoding=UTF-8</vmArgsWin> <vmArgsWin>-Dfile.encoding=UTF-8</vmArgsWin>
</launcherArgs> </launcherArgs>
@ -36,7 +36,6 @@
</launcher> </launcher>
<vm> <vm>
<linux include="true">jdk1.6.0</linux>
<windows include="true">jdk1.6.0</windows> <windows include="true">jdk1.6.0</windows>
</vm> </vm>

View file

@ -44,15 +44,6 @@
</layout> </layout>
</appender--> </appender-->
<appender name="AlertVizInternalLogAppender" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${user.home}/caveData/logs/alertviz-%d{yyyyMMdd}.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<logger name="gov.noaa.nws.ncep"> <logger name="gov.noaa.nws.ncep">
<level value="INFO"/> <level value="INFO"/>
<appender-ref ref="NcepILogAppender"/> <appender-ref ref="NcepILogAppender"/>
@ -65,11 +56,6 @@
<appender-ref ref="NcepDailyRollingFileAppender"/> <appender-ref ref="NcepDailyRollingFileAppender"/>
</logger> </logger>
<logger name="AlertVizLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AlertVizInternalLogAppender"/>
</logger>
<logger name="com.raytheon"> <logger name="com.raytheon">
<level value="INFO"/> <level value="INFO"/>
</logger> </logger>

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.common.message;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.lang.management.ManagementFactory;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -62,8 +63,6 @@ public class StatusMessage implements ISerializableObject, IMessage {
private static final int MAX_MESSAGE_LENGTH = 1024; private static final int MAX_MESSAGE_LENGTH = 1024;
private static final String LOCAL = "LOCAL";
/** /**
* The source of the message * The source of the message
*/ */
@ -162,7 +161,7 @@ public class StatusMessage implements ISerializableObject, IMessage {
this.category = category; this.category = category;
this.priority = priority; this.priority = priority;
this.plugin = plugin; this.plugin = plugin;
this.setMachine(LOCAL); this.setMachineToCurrent();
buildMessageAndDetails(message, throwable, this); buildMessageAndDetails(message, throwable, this);
} }
@ -287,6 +286,13 @@ public class StatusMessage implements ISerializableObject, IMessage {
this.machine = machine; this.machine = machine;
} }
/**
* Set to the current machine.
*/
public void setMachineToCurrent() {
this.machine = ManagementFactory.getRuntimeMXBean().getName();
}
/** /**
* @return the message * @return the message
*/ */
@ -405,7 +411,6 @@ public class StatusMessage implements ISerializableObject, IMessage {
@Override @Override
public String toString() { public String toString() {
Priority p = getPriority();
String statusMsg = getMessage(); String statusMsg = getMessage();
String detailsMsg = getDetails(); String detailsMsg = getDetails();
boolean useBothMsgs = detailsMsg.length() > statusMsg.length(); boolean useBothMsgs = detailsMsg.length() > statusMsg.length();

View file

@ -237,7 +237,7 @@ public class EDEXUtil implements ApplicationContextAware {
sm.setPlugin(pluginName); sm.setPlugin(pluginName);
sm.setCategory(category); sm.setCategory(category);
sm.setMessage(message); sm.setMessage(message);
sm.setMachine(Integer.toString(getServerId())); sm.setMachineToCurrent();
sm.setSourceKey(source); sm.setSourceKey(source);
sm.setDetails(details); sm.setDetails(details);
sm.setEventTime(new Date()); sm.setEventTime(new Date());