|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.danube.support.logging.LoggingConnectionHandler
public class LoggingConnectionHandler
Connection handler that logs connection to a file.
Nested Class Summary | |
---|---|
static class |
LoggingConnectionHandler.InternalFileOutputStream
This is helper class that adds reference to original File class
passed in FileOutputStream . |
Field Summary | |
---|---|
protected Pattern |
addressPattern
Client socket address pattern |
protected String |
logFileNamePattern
Log file name pattern |
protected org.slf4j.Logger |
logger
Logger |
Constructor Summary | |
---|---|
LoggingConnectionHandler()
Constructor |
Method Summary | |
---|---|
protected void |
closeOutputStream(LoggingConnection loggingConnection,
OutputStream logOutputStream)
This method closes output stream and then checks if it needs to be removed or not. |
protected OutputStream |
createLogOutputStream(Connection connection,
boolean temporary)
This method creates log output stream. |
String |
getAddressPattern()
Returns address pattern. |
ConnectionHandler |
getConnectionHandler()
Returns connection handler |
String |
getLogFileNamePattern()
Returns log file name pattern |
File |
getLogsPath()
Returns log files path |
void |
handleConnection(Connection connection)
This method wrapps connection to logging connection and passes it further. |
boolean |
isDirectional()
Is logging directional or not |
boolean |
isLogging()
Returns if logging is switched on or off. |
boolean |
isResolveRemoteHostNames()
Returns if host names should be resolved or not. |
boolean |
isTempLogging()
Returns if temporary logs be created or not. |
void |
setAddressPattern(String addressPatternString)
Sets socket address pattern. |
void |
setConnectionHandler(ConnectionHandler connectionHandler)
Sets connection handler |
void |
setDirectional(boolean directional)
Sets for logging to be directional or not |
void |
setLogFileNamePattern(String logFileNamePatternString)
Sets the log file name pattern. |
void |
setLogging(boolean logging)
Switches logging on or off |
void |
setLogsPath(File logsPath)
Sets log files path |
void |
setResolveRemoteHostNames(boolean resolveRemoteHostNames)
Sets if remote host names are to be resolved or not. |
void |
setTempLogging(boolean tempLogging)
Sets temporary logging. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.slf4j.Logger logger
protected Pattern addressPattern
protected String logFileNamePattern
Constructor Detail |
---|
public LoggingConnectionHandler()
Method Detail |
---|
public String getAddressPattern()
public void setAddressPattern(String addressPatternString)
addressPatternString
- public ConnectionHandler getConnectionHandler()
public void setConnectionHandler(ConnectionHandler connectionHandler)
connectionHandler
- connection handlerpublic boolean isDirectional()
public void setDirectional(boolean directional)
directional
- is logging directional or notpublic String getLogFileNamePattern()
public void setLogFileNamePattern(String logFileNamePatternString)
%c
- current time milliseconds as a long string%D
- current date%T
- current time%A
- local address%P
- local port%a
- remote address%p
- remote port
public boolean isLogging()
public void setLogging(boolean logging)
logging
- true
if logging is to be switched onpublic File getLogsPath()
public void setLogsPath(File logsPath)
logsPath
- log files pathpublic boolean isTempLogging()
public void setTempLogging(boolean tempLogging)
LoggingConnection
itself.
tempLogging
- public boolean isResolveRemoteHostNames()
setAddressPattern(String)
)
public void setResolveRemoteHostNames(boolean resolveRemoteHostNames)
setAddressPattern(String)
)
resolveRemoteHostNames
- public void handleConnection(Connection connection)
isLogging()
, getAddressPattern()
and isTempLogging()
.
handleConnection
in interface ConnectionHandler
connection
- original connectionprotected OutputStream createLogOutputStream(Connection connection, boolean temporary)
LoggingConnectionHandler.InternalFileOutputStream
but it can be overriden
with any other output stream.
connection
- original connectiontemporary
- is file supposed to be temporary or not
protected void closeOutputStream(LoggingConnection loggingConnection, OutputStream logOutputStream)
loggingConnection
- logging connectionlogOutputStream
- log output stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |