Package org.apache.log.output
Class ServletOutputLogTarget
- java.lang.Object
-
- org.apache.log.output.AbstractTarget
-
- org.apache.log.output.AbstractOutputTarget
-
- org.apache.log.output.ServletOutputLogTarget
-
- All Implemented Interfaces:
ErrorAware
,LogTarget
,Closeable
public class ServletOutputLogTarget extends AbstractOutputTarget
Generic logging interface. Implementations are based on the strategy pattern.- Author:
- Tommy Santoso
-
-
Field Summary
Fields Modifier and Type Field Description private javax.servlet.ServletContext
m_context
-
Constructor Summary
Constructors Constructor Description ServletOutputLogTarget(javax.servlet.ServletContext context)
Constructor.ServletOutputLogTarget(javax.servlet.ServletContext context, Formatter formatter)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Shutdown target.protected void
write(java.lang.String message)
Logs message to servlet context log file-
Methods inherited from class org.apache.log.output.AbstractOutputTarget
doProcessEvent, getFormatter, open
-
Methods inherited from class org.apache.log.output.AbstractTarget
getErrorHandler, isOpen, processEvent, setErrorHandler
-
-
-
-
Constructor Detail
-
ServletOutputLogTarget
public ServletOutputLogTarget(javax.servlet.ServletContext context, Formatter formatter)
Constructor.- Parameters:
context
- ServletContext to use for logging.
-
ServletOutputLogTarget
public ServletOutputLogTarget(javax.servlet.ServletContext context)
Constructor.- Parameters:
context
- ServletContext to use for logging.
-
-
Method Detail
-
write
protected void write(java.lang.String message)
Logs message to servlet context log file- Overrides:
write
in classAbstractOutputTarget
- Parameters:
message
- message to log to servlet context log file.
-
close
public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractOutputTarget
-
-