本文整理汇总了Java中org.productivity.java.syslog4j.SyslogConstants.LEVEL_NOTICE属性的典型用法代码示例。如果您正苦于以下问题:Java SyslogConstants.LEVEL_NOTICE属性的具体用法?Java SyslogConstants.LEVEL_NOTICE怎么用?Java SyslogConstants.LEVEL_NOTICE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.productivity.java.syslog4j.SyslogConstants
的用法示例。
在下文中一共展示了SyslogConstants.LEVEL_NOTICE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLevelString
public static final String getLevelString(int level) {
switch(level) {
case SyslogConstants.LEVEL_DEBUG: return "DEBUG";
case SyslogConstants.LEVEL_INFO: return "INFO";
case SyslogConstants.LEVEL_NOTICE: return "NOTICE";
case SyslogConstants.LEVEL_WARN: return "WARN";
case SyslogConstants.LEVEL_ERROR: return "ERROR";
case SyslogConstants.LEVEL_CRITICAL: return "CRITICAL";
case SyslogConstants.LEVEL_ALERT: return "ALERT";
case SyslogConstants.LEVEL_EMERGENCY: return "EMERGENCY";
default:
return "UNKNOWN";
}
}
示例2: getLog4jLevel
protected static Level getLog4jLevel(int level) {
switch(level) {
case SyslogConstants.LEVEL_DEBUG: return Level.DEBUG;
case SyslogConstants.LEVEL_INFO: return Level.INFO;
case SyslogConstants.LEVEL_NOTICE: return Level.INFO;
case SyslogConstants.LEVEL_WARN: return Level.WARN;
case SyslogConstants.LEVEL_ERROR: return Level.ERROR;
case SyslogConstants.LEVEL_CRITICAL: return Level.ERROR;
case SyslogConstants.LEVEL_ALERT: return Level.ERROR;
case SyslogConstants.LEVEL_EMERGENCY: return Level.FATAL;
default:
return Level.WARN;
}
}
示例3: log
public void log(int level, String message) {
if (SyslogConstants.LEVEL_DEBUG == level) { debug(message); }
if (SyslogConstants.LEVEL_INFO == level) { info(message); }
if (SyslogConstants.LEVEL_NOTICE == level) { notice(message); }
if (SyslogConstants.LEVEL_WARN == level) { warn(message); }
if (SyslogConstants.LEVEL_ERROR == level) { error(message); }
if (SyslogConstants.LEVEL_CRITICAL == level) { critical(message); }
if (SyslogConstants.LEVEL_ALERT == level) { alert(message); }
if (SyslogConstants.LEVEL_EMERGENCY == level) { emergency(message); }
}
示例4: sendMessage
static public void sendMessage(SyslogIF syslog, int priority,String message,
boolean addTimestamp, String pattern,
boolean addHostName) {
String messageString =message;
// Do we need to add hostname?
if(addHostName) {
messageString= Const.getHostname() + " " +messageString;
}
// Do we need to add timestamp
if(addTimestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat (pattern);
dateFormat.setTimeZone(TimeZone.getDefault());
messageString = dateFormat.format( Calendar.getInstance().getTime() ) + " : " + messageString;
}
// send message
switch(priority) {
case SyslogConstants.LEVEL_EMERGENCY : syslog.emergency(messageString); break;
case SyslogConstants.LEVEL_ALERT : syslog.alert(messageString); break;
case SyslogConstants.LEVEL_CRITICAL : syslog.critical(messageString); break;
case SyslogConstants.LEVEL_ERROR : syslog.error(messageString); break;
case SyslogConstants.LEVEL_WARN : syslog.warn(messageString); break;
case SyslogConstants.LEVEL_NOTICE : syslog.notice(messageString); break;
case SyslogConstants.LEVEL_INFO : syslog.info(messageString); break;
case SyslogConstants.LEVEL_DEBUG : syslog.debug(messageString); break;
default: break;
}
}
示例5: determineLogLevel
private int determineLogLevel(final OnmsSeverity severity) {
int level;
switch (severity) {
case CRITICAL:
level = SyslogConstants.LEVEL_CRITICAL;
break;
case MAJOR:
level = SyslogConstants.LEVEL_ERROR;
break;
case MINOR:
level = SyslogConstants.LEVEL_ERROR;
break;
case WARNING:
level = SyslogConstants.LEVEL_WARN;
case NORMAL:
level = SyslogConstants.LEVEL_NOTICE;
break;
case CLEARED:
level = SyslogConstants.LEVEL_INFO;
break;
case INDETERMINATE:
level = SyslogConstants.LEVEL_DEBUG;
break;
default:
level = SyslogConstants.LEVEL_WARN;
}
return level;
}
示例6: sendMessage
public static void sendMessage( SyslogIF syslog, int priority, String message, boolean addTimestamp,
String pattern, boolean addHostName ) {
String messageString = message;
// Do we need to add hostname?
if ( addHostName ) {
messageString = Const.getHostname() + " " + messageString;
}
// Do we need to add timestamp
if ( addTimestamp ) {
SimpleDateFormat dateFormat = new SimpleDateFormat( pattern );
dateFormat.setTimeZone( TimeZone.getDefault() );
messageString = dateFormat.format( Calendar.getInstance().getTime() ) + " : " + messageString;
}
// send message
switch ( priority ) {
case SyslogConstants.LEVEL_EMERGENCY:
syslog.emergency( messageString );
break;
case SyslogConstants.LEVEL_ALERT:
syslog.alert( messageString );
break;
case SyslogConstants.LEVEL_CRITICAL:
syslog.critical( messageString );
break;
case SyslogConstants.LEVEL_ERROR:
syslog.error( messageString );
break;
case SyslogConstants.LEVEL_WARN:
syslog.warn( messageString );
break;
case SyslogConstants.LEVEL_NOTICE:
syslog.notice( messageString );
break;
case SyslogConstants.LEVEL_INFO:
syslog.info( messageString );
break;
case SyslogConstants.LEVEL_DEBUG:
syslog.debug( messageString );
break;
default:
break;
}
}