diff options
author | Jiri Vanek <[email protected]> | 2014-01-20 14:59:17 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2014-01-20 14:59:17 +0100 |
commit | c6f420acd38b2036d17685efde866debc627c26e (patch) | |
tree | ae292a6d312001a1c212944884d3578de0d6889b /netx/net/sourceforge/jnlp | |
parent | c4bef6cad39892b850022c8f85c1edd97b0c7b40 (diff) |
Added support for system level linux logging
Diffstat (limited to 'netx/net/sourceforge/jnlp')
-rw-r--r-- | netx/net/sourceforge/jnlp/util/logging/OutputController.java | 9 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java | 21 |
2 files changed, 22 insertions, 8 deletions
diff --git a/netx/net/sourceforge/jnlp/util/logging/OutputController.java b/netx/net/sourceforge/jnlp/util/logging/OutputController.java index 3bec9f0..554a05d 100644 --- a/netx/net/sourceforge/jnlp/util/logging/OutputController.java +++ b/netx/net/sourceforge/jnlp/util/logging/OutputController.java @@ -174,8 +174,13 @@ public class OutputController { if (LogConfig.getLogConfig().isLogToFile()) { getFileLog().log(message); } - if (LogConfig.getLogConfig().isLogToSysLog()) { - getSystemLog().log(message); + //only crucial stuff is going to system log + //only java messages handled here, plugin is onhis own + if (LogConfig.getLogConfig().isLogToSysLog() && + (s.getHeader().level.equals(Level.ERROR_ALL) || s.getHeader().level.equals(Level.WARNING_ALL)) && + s.getHeader().isC == false) { + //no headers here + getSystemLog().log(s.getMessage()); } } diff --git a/netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java b/netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java index 157d91f..2571178 100644 --- a/netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java +++ b/netx/net/sourceforge/jnlp/util/logging/UnixSystemLog.java @@ -44,14 +44,23 @@ public class UnixSystemLog implements SingleStreamLogger{ } - + @Override - public void log(String s) { - + public void log(String message) { + final String s = "IcedTea-Web java error - for more info see itweb-settings debug options or console. See http://icedtea.classpath.org/wiki/IcedTea-Web#Filing_bugs for help.\nIcedTea-Web java error manual log: \n" + message; + try { + String[] ss = s.split("\\n"); //exceptions have many lines + for (String m : ss) { + m = m.replaceAll("\t", " "); + ProcessBuilder pb = new ProcessBuilder("logger", "-p","user.err", "--", m); + Process p = pb.start(); + p.waitFor(); + OutputController.getLogger().log("System logger called with result of " + p.exitValue()); + } + } catch (Exception ex) { + OutputController.getLogger().log(ex); + } } - - - } |