LogService
import io.skipcheck.tm1.client.service.server.LogService;Used in the walkthrough Run a process and read its result.
The server's logs: the message log, the transaction log (cell changes), the audit log (changes to objects and security), and the error logs processes write.
What TM1 (11.8) does here that you might not expect:
- An entry's
IDnumbers it within the response, not in the log: the same entry gets another ID in the next request, and TM1 refuses to fetch an entry by its ID (501, "Indexing of message log entries is not supported"). So there's no get by ID here. - A message log entry without a time, such as the log's first line, has the
TimeStamp0000-00-00T00:00Z; it's read asnull. - The transaction and audit logs only fill when they're switched on (a cube's
logging, and
AuditLogin the configuration).
Read the newest message log entries:
// The 50 newest entries, newest first
return tm1.logs().messageLog(true, ODataQuery.none().top(50));
Follow the message log for errors:
// Errors as they're written, until the subscriber cancels; each poll is every 5 s
return tm1.logs()
.tailMessageLog(Duration.ofSeconds(5))
.filter(entry -> entry.level() == LogLevel.ERROR)
.map(entry -> entry.logger() + ": " + entry.message());
Read a process's error logs:
// What each error log of one process says
return tm1.logs()
.errorLogFiles(ODataQuery.none())
.filter(file -> file.filename() != null && file.filename().endsWith("_Load Sales.log"))
.concatMap(file -> tm1.logs().errorLogContent(file.filename()));
Count the cell changes in the transaction log:
// How many cell changes the transaction log holds, leaving out its status lines
return tm1.logs().transactionLog(false, true, ODataQuery.none()).count();
Members
LogService constructor | A service sending its requests through session. |
messageLogEntries | GET MessageLogEntries, streamed, oldest first unless ordered otherwise. |
messageLog | The message log, streamed, newest first if reverse. |
transactionLogEntries | GET TransactionLogEntries, streamed. |
transactionLog | The transaction log, streamed. |
auditLogEntries | GET AuditLogEntries, streamed; empty unless the audit log is on. |
tailMessageLog | Follows the message log. |
tailTransactionLog | Follows the transaction log, as tailMessageLog does the message log. |
tailAuditLog | Follows the audit log, as tailMessageLog does the message log. |
errorLogFiles | GET ErrorLogFiles, streamed. |
errorLogFile | GET ErrorLogFiles('name'). |
errorLogContent | What the file says, as text, read whole. |
LogService
constructorLogService(Tm1Session session) A service sending its requests through session.
Parameters
session- the session
messageLogEntries
Flux<MessageLogEntry> messageLogEntries(ODataQuery query) GET MessageLogEntries, streamed, oldest first unless ordered otherwise.
Parameters
query- what to select, filter (such as on
LevelorTimeStamp), order and how many
Returns
- the entries
TM1 REST EntitySet MessageLogEntries
messageLog
Flux<MessageLogEntry> messageLog(boolean reverse, ODataQuery query) MessageLog(Reverse=…): the message log, streamed, newest first if
reverse.
Parameters
reverse- whether to start with the newest entry
query- what to select, filter and how many
Returns
- the entries
TM1 REST FunctionImport MessageLog
transactionLogEntries
Flux<TransactionLogEntry> transactionLogEntries(ODataQuery query) GET TransactionLogEntries, streamed. Besides cell changes, the log holds
status lines (such as CubeSerialized: …) with only StatusMessage
set.
TM1 (11.8) logs a password being set as a change of the PASSWORD cell of
ClientProperties}, and writes the new value, the password's hash, as raw
bytes that aren't UTF-8. They read as U+FFFD, the replacement character, here and
in the other transaction log methods.
Parameters
query- what to select, filter (such as on
Cube), order and how many
Returns
- the entries
TM1 REST EntitySet TransactionLogEntries
transactionLog
Flux<TransactionLogEntry> transactionLog(boolean reverse, boolean ignoreStatusMessages, ODataQuery query) TransactionLog(Reverse=…,IgnoreStatusMessages=…): the transaction log,
streamed.
Parameters
reverse- whether to start with the newest entry
ignoreStatusMessages- whether to leave out status lines, keeping cell changes
query- what to select, filter and how many
Returns
- the entries
TM1 REST FunctionImport TransactionLog
auditLogEntries
Flux<AuditLogEntry> auditLogEntries(ODataQuery query) GET AuditLogEntries, streamed; empty unless the audit log is on.
Parameters
query- what to select, filter, order, and expand (
AuditDetails, the entry's details)
Returns
- the entries
tailMessageLog
Flux<MessageLogEntry> tailMessageLog(Duration every) Follows the message log: the entries written from the moment of subscribing,
polling every every until cancelled. Built on TailMessageLog()
(schema 11.3.0).
TailMessageLog() returns a delta link, but TM1 (11.8) answers it with every
entry since the link was made, each time, and with no next link. So this keeps the
one link and skips the entries it has already emitted, and each poll fetches more
the longer it runs. For a long watch, subscribe afresh now and then.
Parameters
every- how long to wait between polls
Returns
- the new entries, as they come
TM1 REST FunctionImport TailMessageLog
tailTransactionLog
Flux<TransactionLogEntry> tailTransactionLog(Duration every) Follows the transaction log, as tailMessageLog does the message log. Built
on TailTransactionLog() (schema 11.3.0).
Parameters
every- how long to wait between polls
Returns
- the new entries, as they come
TM1 REST FunctionImport TailTransactionLog
tailAuditLog
Flux<AuditLogEntry> tailAuditLog(Duration every) Follows the audit log, as tailMessageLog does the message log. Built on
TailAuditLog() (schema 11.6.0).
Parameters
every- how long to wait between polls
Returns
- the new entries, as they come
TM1 REST FunctionImport TailAuditLog
errorLogFiles
Flux<ErrorLogFile> errorLogFiles(ODataQuery query) GET ErrorLogFiles, streamed: the error logs processes have written, such as
tm1processerror_<time>_<process>.log.
Parameters
query- what to select, filter and order
Returns
- the files
TM1 REST EntitySet ErrorLogFiles
errorLogFile
Mono<ErrorLogFile> errorLogFile(String filename, ODataQuery query) GET ErrorLogFiles('name').
Parameters
filename- the file's name
query- what to select
Returns
- the file, or a
Tm1NotFoundExceptionif there's none
TM1 REST EntitySet ErrorLogFiles
errorLogContent
Mono<String> errorLogContent(String filename) GET ErrorLogFiles('name')/Content: what the file says, as text, read whole.
TM1 (11.8) starts it with a byte order mark, which is dropped.
Parameters
filename- the file's name
Returns
- the text
TM1 REST EntitySet ErrorLogFiles
Also in the Javadoc.