b844d2f675b50760cacb635ada85a8b1f409e2a1
2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 package org
.lttng
.ust
.agent
.jul
;
20 import java
.lang
.String
;
22 import java
.util
.logging
.Handler
;
23 import java
.util
.logging
.LogRecord
;
25 class LTTngLogHandler
extends Handler
{
27 private final Boolean isRoot
;
29 public LTTngLogHandler(Boolean isRoot
) {
32 /* Initialize LTTng UST tracer. */
34 System
.loadLibrary("lttng-ust-jul-jni"); //$NON-NLS-1$
35 } catch (SecurityException e
) {
37 } catch (UnsatisfiedLinkError e
) {
39 } catch (NullPointerException e
) {
40 /* Should never happen */
45 public Boolean
isRoot() {
50 public void close() throws SecurityException
{}
53 public void flush() {}
56 public void publish(LogRecord record
) {
58 * Specific tracepoint designed for JUL events. The source class of the
59 * caller is used for the event name, the raw message is taken, the
60 * loglevel of the record and the thread ID.
63 tracepointS(record
.getMessage(),
64 record
.getLoggerName(), record
.getSourceClassName(),
65 record
.getSourceMethodName(), record
.getMillis(),
66 record
.getLevel().intValue(), record
.getThreadID());
68 tracepointU(record
.getMessage(),
69 record
.getLoggerName(), record
.getSourceClassName(),
70 record
.getSourceMethodName(), record
.getMillis(),
71 record
.getLevel().intValue(), record
.getThreadID());
75 /* Use for a user session daemon. */
76 private native void tracepointU(String msg
,
84 /* Use for a root session daemon. */
85 private native void tracepointS(String msg
,
This page took 0.047939 seconds and 3 git commands to generate.