Here's how you can override the default log filters for the various log streams. For the openclovis nodename log files in var/log/<NODENAME>.log, you can use the env
export CL_LOG_SEVERITY=DEBUG
to override the default severity of NOTICE.
For pre-created openclovis sys or app log streams, you can use the env:
export CL_LOG_STREAM_SEVERITY=NOTICE
to override the default severity of DEBUG.
For dynamically created runtime log streams, there is another env. to make your life easier that overrides the default DEBUG severity.
export CL_LOG_STREAM_SEVERITY_CUSTOM=TRACE
and runtime log streams would start getting trace instead of debug.
This can be achieved without writing any code to modify the severity of runtime created stream/s.
All of the above can be configured pretty easily by modifications to asp.conf.
However, if you still want to modify runtime stream filter level using code/api given the clLogStreamOpen returned stream handle after open, you can use the below code snippet that uses clLogFilterSet to modify the log severity.
ClRcT setLogStreamSeverity(const ClNameT *pStreamName,
ClLogStreamHandleT stream, ClUint32T sev)
{
ClRcT rc = CL_OK; ClLogFilterT filter = {0}; filter.severityFilter = ( 1 << sev) -1; clLogDebug("FILTER", "SET", "Setting log severity for stream [%.*s] to [%s]", pStreamName->length, pStreamName->value, clLogSeverityStrGet(sev)); rc = clLogFilterSet(stream, CL_LOG_FILTER_ASSIGN, filter); if(rc != CL_OK) { clLogError("FILTER", "SET", "Setting log filter for app stream returned with [%#x]", rc); } return rc;
}
For eg:, to change the severity of a runtime example_stream to TRACE, you can use it as below:
ClNameT streamName;
clNameSet(&streamName, "example_stream");
setLogStreamSeverity(&streamName, streamOpenHandle, CL_LOG_SEV_TRACE);