a20aed21707b48d67fbf2431e1e1d58527339989
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
{
26 private Boolean is_root
;
28 public LTTngLogHandler(Boolean isRoot
) {
30 this.is_root
= isRoot
;
31 /* Initialize LTTng UST tracer. */
33 System
.loadLibrary("lttng-ust-jul-jni"); //$NON-NLS-1$
34 } catch (SecurityException e
) {
36 } catch (UnsatisfiedLinkError e
) {
38 } catch (NullPointerException e
) {
39 /* Should never happen */
44 public Boolean
isRoot() {
49 public void close() throws SecurityException
{}
52 public void flush() {}
55 public void publish(LogRecord record
) {
57 * Specific tracepoing designed for JUL events. The source class of the
58 * caller is used for the event name, the raw message is taken, the
59 * loglevel of the record and the thread ID.
62 tracepointS(record
.getMessage(),
63 record
.getLoggerName(), record
.getSourceClassName(),
64 record
.getSourceMethodName(), record
.getMillis(),
65 record
.getLevel().intValue(), record
.getThreadID());
67 tracepointU(record
.getMessage(),
68 record
.getLoggerName(), record
.getSourceClassName(),
69 record
.getSourceMethodName(), record
.getMillis(),
70 record
.getLevel().intValue(), record
.getThreadID());
74 /* Use for a user session daemon. */
75 private native void tracepointU(String msg
, String logger_name
, String class_name
,
76 String method_name
, long millis
, int log_level
, int thread_id
);
78 /* Use for a root session daemon. */
79 private native void tracepointS(String msg
, String logger_name
, String class_name
,
80 String method_name
, long millis
, int log_level
, int thread_id
);
This page took 0.031346 seconds and 4 git commands to generate.