1 package cz.cuni.amis.pogamut.base.utils.logging;
2
3 import java.util.logging.LogRecord;
4
5 /**
6 * Java logging API relies on handlers for publishing records, we have
7 * created one instance of this Handler (LogHandler instnace) and delegate
8 * abstract methods from Handler on the publisher interface.
9 * <p><p>
10 * Default implementation LogPublisher exists which is using Formatter
11 * to format the LogRecord - inside this LogPublisher you will find
12 * public static inner class with default implementation for publishing
13 * log records to Console or File (LogPublisher.ConsolePublisher and
14 * LogPublisher.FilePublisher classes).
15 *
16 * @author Jimmy
17 */
18 public interface ILogPublisher {
19
20 /**
21 * From JavaDoc API:
22 * <p>
23 * Publish a <tt>LogRecord</tt>.
24 * <p>
25 * The logging request was made initially to a <tt>Logger</tt> object,
26 * which initialized the <tt>LogRecord</tt> and forwarded it here.
27 * <p>
28 * The <tt>Handler</tt> is responsible for formatting the message, when and
29 * if necessary. The formatting should include localization.
30 * <hr>
31 *
32 *
33 * @param record description of the log event. A null record is
34 * silently ignored and is not published
35 */
36 public void publish(LogRecord record);
37
38 /**
39 * From JavaDoc API:
40 * <p>
41 * Flush any buffered output.
42 */
43 public void flush();
44
45 /**
46 * From JavaDoc API:
47 * <p>
48 * Close the <tt>Handler</tt> and free all associated resources.
49 * <p>
50 * The close method will perform a <tt>flush</tt> and then close the
51 * <tt>Handler</tt>. After close has been called this <tt>Handler</tt>
52 * should no longer be used. Method calls may either be silently
53 * ignored or may throw runtime exceptions.
54 *
55 * @exception SecurityException if a security manager exists and if
56 * the caller does not have <tt>LoggingPermission("control")</tt>.
57 */
58 public void close() throws SecurityException;
59
60 }