public class JCFileEventLog extends Object implements IJCEventLog
IJCEventLog that appends all bridge
diagnostic messages to a text file.
Register an instance with JCOBridge.RegisterEventLog(org.mases.jcobridge.IJCEventLog) to redirect
bridge events and fusion log entries to a file. Each message is written on its
own line via a BufferedWriter. Write errors are silently swallowed to
avoid masking bridge errors with logging failures.
The file is opened (and created if necessary) in the constructor and remains open for the lifetime of this instance. The caller is responsible for flushing or closing the underlying writer if unflushed data must be persisted before the process exits.
Example:
JCOBridge bridge = JCOBridge.CreateNew();
bridge.RegisterEventLog(new JCFileEventLog("/var/log/jcobridge.log"));
| Constructor and Description |
|---|
JCFileEventLog(String fileName)
Opens (or creates) the log file at the given path and prepares the buffered writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
EventLog(String msg)
Receives a general bridge diagnostic event message and appends it to the log file.
|
void |
FusionLog(String msg)
Receives a CLR assembly fusion log message and appends it to the log file.
|
public JCFileEventLog(String fileName) throws IOException
fileName - the path to the log file.IOException - if the file cannot be opened or created.public void FusionLog(String msg)
FusionLog in interface IJCEventLogmsg - the fusion log message from the CLR assembly resolver.public void EventLog(String msg)
EventLog in interface IJCEventLogmsg - the diagnostic message from the JCOBridge runtime.