Compartilhar via


FileLogger Class

  • java.lang.Object
    • com.microsoft.cognitiveservices.speech.diagnostics.logging.FileLogger

public final class FileLogger

A static class to control file-based SDK logging. Turning on logging while running your Speech SDK scenario provides detailed information from the SDK's core native components. If you report an issue to Microsoft, you may be asked to provide logs to help Microsoft diagnose the issue. Your application should not take dependency on particular log strings, as they may change from one SDK release to another without notice. FileLogger is the simplest logging solution and suitable for diagnosing most on-device issues when running Speech SDK. Added in version 1.42.0

File logging is a process wide construct. That means that if (for example) you have multiple speech recognizer objects running in parallel, there will be one log file containing interleaved logs lines from all recognizers. You cannot get a separate log file for each recognizer.

Method Summary

Modifier and Type Method and Description
static void setFilters()

Clears filters for logging messages to a file.

static void setFilters(String[] filters)

Sets filters for logging messages to a file.

static void setLevel(Level level)

Sets the level of the messages to be captured by the logger.

static void start(String filePath)

Start logging to a file without appending.

static void start(String filePath, boolean append)

Starts logging to a file with an option to append.

static void stop()

Stops logging to a file.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Method Details

setFilters

public static void setFilters()

Clears filters for logging messages to a file.

setFilters

public static void setFilters(String[] filters)

Sets filters for logging messages to a file. Once filters are set, file logger will only be updated with log strings containing at least one of the strings specified by the filters. The match is case sensitive.

Parameters:

filters - Filters to use, or an empty list to remove previously set filters.

setLevel

public static void setLevel(Level level)

Sets the level of the messages to be captured by the logger.

Parameters:

level - Maximum level of detail to be captured by the logger.

start

public static void start(String filePath)

Start logging to a file without appending.

Parameters:

filePath - Path of resulting log file

start

public static void start(String filePath, boolean append)

Starts logging to a file with an option to append.

Parameters:

filePath - Path of resulting log file
append - If true will append to file (if already exists). Otherwise will create a new file

stop

public static void stop()

Stops logging to a file.

This call is optional. If logging has been started, the log file will be written when the process exits normally.

Applies to