public abstract class SqlMessage extends Object
Message
s associated with log4jdbc log events,
to perform common operations such as sql formatting.
Subclasses must implement the abstract buildMessage()
method,
that will then be called by the method getFormattedMessage()
of this class,
to populate the message
attribute, only once.
This way, messages are generated only once, and only when needed
(avoid useless strings concatenations for instance).
Modifier and Type | Field and Description |
---|---|
protected static String |
nl
System dependent line separator.
|
Constructor and Description |
---|
SqlMessage()
Default constructor.
|
SqlMessage(boolean isDebugEnabled)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
buildMessage()
Populate the
message attribute. |
protected static String |
getDebugInfo()
Get debugging info - the module and line number that called the logger
version that prints the stack trace information from the point just before
we got it (net.sf.log4jdbc)
if the optional log4jdbc.debug.stack.prefix system property is defined then
the last call point from an application is shown in the debug
trace output, instead of the last direct caller into log4jdbc
|
String |
getFormat() |
String |
getFormattedMessage() |
protected String |
getMessage() |
Object[] |
getParameters() |
Throwable |
getThrowable()
Always return
null , no messages store a Throwable in this project. |
protected boolean |
isDebugEnabled() |
protected String |
processSql(String sql)
Break an SQL statement up into multiple lines in an attempt to make it
more readable.
|
protected void |
setDebugEnabled(boolean isDebugEnabled) |
protected void |
setMessage(String message) |
protected static String nl
public SqlMessage()
public SqlMessage(boolean isDebugEnabled)
isDebugEnabled
- A boolean
used to set the isDebugEnabled
attributeisDebugEnabled
protected abstract void buildMessage()
message
attribute.
All subclasses can implement this method as they want,
but the outcome must be to assign a String
not null
to the message
attribute.
This method is called only when this Message
is actually logged,
avoiding useless concatenation costs, etc.message
public String getFormattedMessage()
public String getFormat()
public Object[] getParameters()
public Throwable getThrowable()
null
, no messages store a Throwable
in this project.null
protected String processSql(String sql)
sql
- SQL to break up.protected static String getDebugInfo()
protected boolean isDebugEnabled()
protected void setDebugEnabled(boolean isDebugEnabled)
isDebugEnabled
- the isDebugEnabled to setprotected String getMessage()
protected void setMessage(String message)
message
- the message to setCopyright © 2013 Bgee - Swiss Institute of Bioinformatics. All Rights Reserved.