1 28 29 package com.caucho.vfs; 30 31 34 public class Syslog { 35 public static final int LOG_KERN = 0; 36 public static final int LOG_USER = 1; 37 public static final int LOG_MAIL = 2; 38 public static final int LOG_DAEMON = 3; 39 public static final int LOG_AUTH = 4; 40 public static final int LOG_SYSLOG = 5; 41 public static final int LOG_LPR = 6; 42 public static final int LOG_NEWS = 7; 43 public static final int LOG_UUCP = 8; 44 public static final int LOG_CRON = 9; 45 public static final int LOG_AUTHPRIV = 10; 46 public static final int LOG_FTP = 11; 47 public static final int LOG_LOCAL0 = 16; 48 public static final int LOG_LOCAL1 = 17; 49 public static final int LOG_LOCAL2 = 18; 50 public static final int LOG_LOCAL3 = 19; 51 public static final int LOG_LOCAL4 = 20; 52 public static final int LOG_LOCAL5 = 21; 53 public static final int LOG_LOCAL6 = 22; 54 public static final int LOG_LOCAL7 = 23; 55 56 public static final int LOG_EMERG = 0; 57 public static final int LOG_ALERT = 1; 58 public static final int LOG_CRIT = 2; 59 public static final int LOG_ERR = 3; 60 public static final int LOG_WARNING = 4; 61 public static final int LOG_NOTICE = 5; 62 public static final int LOG_INFO = 6; 63 public static final int LOG_DEBUG = 7; 64 65 private static boolean _hasSyslog; 66 private static boolean _isOpen; 67 68 public Syslog() 69 { 70 } 71 72 75 public static void syslog(int facility, int severity, String text) 76 { 77 if (! _isOpen) { 78 _isOpen = true; 79 nativeOpenSyslog(); 80 } 81 82 int priority = facility * 8 + severity; 83 84 nativeSyslog(priority, text); 85 } 86 87 private static native void nativeOpenSyslog(); 88 89 private static native void nativeSyslog(int priority, String text); 90 91 static { 92 try { 93 System.loadLibrary("resin"); 94 _hasSyslog = true; 95 } catch (Throwable e) { 96 } 97 } 98 } 99 100 | Popular Tags |