This class provides methods to write a log file.
More...
|
| void | init (String filename, int level, int size) |
| | Initializes a log file with the given name, level and maximum size. More...
|
| |
| void | init (String filename, LogLevel level, int size) |
| | Initializes a log file with the given name, level and maximum size. More...
|
| |
| void | init (CryptoServerConfig config) |
| | Initializes log file according to the given configuration object. More...
|
| |
|
| CryptoServerLog () |
| | Creates a default log file ("CryptoServer.log") with a default log level (LOG_LEVEL_WARNING) and a default maximum size of 1MB.
|
| |
| | CryptoServerLog (String filename, int level, int size) |
| | Creates a log file with the given name, level and maximum size. More...
|
| |
| | CryptoServerLog (String filename, LogLevel level, int size) |
| | Initializes a log file with the given name, level and maximum size. More...
|
| |
| | CryptoServerLog (CryptoServerConfig config) |
| | Initializes log file according to the given configuration object. More...
|
| |
| void | print (String where, String format, Object...args) |
| | Prints a new log entry. More...
|
| |
| void | xtrace (String where, String message, byte[] data) |
| | Writes binary data to the log file. More...
|
| |
This class provides methods to write a log file.
- Example:
The following example illustrates the usage of the CryptoServerLog class:
...
log.
print(
"Method1",
"E: key generation failed with code: 0x%08x", err);
...
byte [] blob = cxi.exportKey(...);
log.
xtrace(
"Method1",
"I: Key blob returned by the CryptoServer", blob);
This class provides methods to write a log file.
Definition: CryptoServerLog.java:26
void print(String where, String format, Object...args)
Prints a new log entry.
Definition: CryptoServerLog.java:221
CryptoServerLog()
Creates a default log file ("CryptoServer.log") with a default log level (LOG_LEVEL_WARNING) and a de...
Definition: CryptoServerLog.java:160
void xtrace(String where, String message, byte[] data)
Writes binary data to the log file.
Definition: CryptoServerLog.java:270
Log level to be set on CryptoServerLog.CryptoServerLog and CryptoServerLog.init.
Definition: CryptoServerLog.java:39
Info
Additionally write informational messages to log file (3)
Definition: CryptoServerLog.java:43
◆ CryptoServerLog() [1/3]
Creates a log file with the given name, level and maximum size.
- Parameters
-
| filename | Name of the log file including path. |
| level | Log level to be applied:
- LOG_LEVEL_NONE - disable logging
- LOG_LEVEL_ERROR - log error messages
- LOG_LEVEL_WARNING - log error messages and warnings
- LOG_LEVEL_INFO - log error messages, warnings and informational messages
- LOG_LEVEL_TRACE - additionally trace data
|
| size | Maximum log file size. |
- Deprecated:
- As of CryptoServerAPI version 1.41 replaced by CryptoServerAPI.CryptoServerLog.CryptoServerLog(String filename, LogLevel level, int size)
◆ CryptoServerLog() [2/3]
Initializes a log file with the given name, level and maximum size.
- Parameters
-
| filename | Name of the log file including path. |
| level | Log level to be applied (see LogLevel)
|
| size | Maximum log file size.
If the actual log file size extends this limit the log file is renamed to *.bak and a new log file is created.
|
- Note
- If the log size value is given as '0' the log file may grow without limitation.
◆ CryptoServerLog() [3/3]
Initializes log file according to the given configuration object.
- Parameters
-
| config | Configuration object. The following key names will be recognized:
| Key | Mandatory | Default Value | Description |
| LogFile | No | "" | Filename (including path) of log file to be written. Use forward slashes as path separator (even on Windows).
|
| LogLevel | No | LogLevel.None | Log level to be applied (see LogLevel)
|
| LogSize | No | 1MB | Maximum log file size before log file is rotated.
The integer value may optionally be followed by a tag ('KB', 'MB' or 'GB').
If this value is configured as '0' log file may grow without limitation.
|
| | |
|
|
◆ init() [1/3]
| void init |
( |
String |
filename, |
|
|
int |
level, |
|
|
int |
size |
|
) |
| |
Initializes a log file with the given name, level and maximum size.
- Parameters
-
| filename | Name of the log file including path. |
| level | Log level to be applied:
- LOG_LEVEL_NONE - disable logging
- LOG_LEVEL_ERROR - log error messages
- LOG_LEVEL_WARNING - log error messages and warnings
- LOG_LEVEL_INFO - log error messages, warnings and informational messages
- LOG_LEVEL_TRACE - additionally trace data
|
| size | Maximum log file size.
If the actual log file size extends this limit the log file is renamed to *.bak and a new log file is created.
|
- Note
- If the log size value is given as '0' the log file may grow without limitation.
- Deprecated:
- As of CryptoServerAPI version 1.41 replaced by CryptoServerAPI.CryptoServerLog.init(String filename, LogLevel level, int size)
◆ init() [2/3]
| void init |
( |
String |
filename, |
|
|
LogLevel |
level, |
|
|
int |
size |
|
) |
| |
Initializes a log file with the given name, level and maximum size.
- Parameters
-
| filename | Name of the log file including path. |
| level | Log level to be applied (see LogLevel)
|
| size | Maximum log file size.
If the actual log file size extends this limit the log file is renamed to *.bak and a new log file is created.
|
- Note
- If the log size value is given as '0' the log file may grow without limitation.
◆ init() [3/3]
Initializes log file according to the given configuration object.
- Parameters
-
| config | Configuration object. The following key names will be recognized:
| Key | Mandatory | Default Value | Description |
| LogFile | No | "" | Filename (including path) of log file to be written. Use forward slashes as path separator (even on Windows).
|
| LogLevel | No | LogLevel.None | Log level to be applied (see LogLevel)
|
| LogSize | No | 1MB | Maximum log file size before log file is rotated.
The integer value may optionally be followed by a tag ('KB', 'MB' or 'GB').
If this value is configured as '0' log file may grow without limitation.
|
| | |
|
|
◆ print()
| void print |
( |
String |
where, |
|
|
String |
format, |
|
|
Object... |
args |
|
) |
| |
Prints a new log entry.
- Parameters
-
| where | Location / method name where log message is written. |
| format | Format string. The string can be prefixed by either 'E:', 'W:', "I:' or 'T:' to indicated at which log level the entry will be printed. |
| args | Argument list. |
◆ xtrace()
| void xtrace |
( |
String |
where, |
|
|
String |
message, |
|
|
byte[] |
data |
|
) |
| |
Writes binary data to the log file.
The data printed as a hexadecimal dump.
- Parameters
-
| where | Location / method name where log message is written. |
| message | Message that prefixes the binary dump. The message can be prefixed by either 'E:', 'W:', "I:' or 'T:' to indicated at which log level the entry will be printed. |
| data | Binary data to be printed to the log file. |