McDewey

Multi-vendor documentation library · semantic search · MCP endpoint at /mcp

Page 766

↗ View in doc context
page
766
source
cucm/v15/jtapi-dev-guide/jtapi-dev-guide.md
chunk_id
cucm::v15::jtapi-dev-guide::jtapi-dev-guide::768

Each of the log files is named according to a pattern controlled by three properties, CurrentFile, FileNameBase, and FileExtension. The CurrentFile property determines which log file, by ordinal number, is being written at present, the FileNameBase property determines the prefix of each log file name, and the FileExtension property determines the suffix, e.g. “txt”. From these properties, log files are named FileNameBase LeadingZeroPadding CurrentFile.FileExtension. The CurrentFile property takes on a value from 1 to the value of the MaxFiles property. Note that the CurrentFile property, when converted to a String, is padded with leading zeroes depending on the values of the MaxFiles and CurrentFile properties. An index file tracks the index of the last file written. If the logFileWriter is recreated (for example if an application is restarted) new files will continue from the last written index. Where the log files are stored is determined by the path, dirNameBase, useSameDir. If a path is not specified, the current path is used as default. If a dirNameBase is not specified, it write log files in the path. Depending upon whether useSameDir is true or false, files are written to the same directory or a new directory, each time an instance of LogFileTraceWriter is created. In case new directories are being made each time, the directory name will consist of the dirNameBase and a number, separated by an ’_’. The number is one more than the greatest number associated with directories with the same dirNameBame in the path. While specifying the path, you may use either a “/” or “\”, but not “\” The LogFileTraceWriter keeps track of how many bytes have been written to the current log file. When that number grows within approximately LogFileTraceWriter.ROLLOVER_THRESHOLD bytes, tracing continues to the next file, which is either CurrentFile + 1 if CurrentFile is not equal to MaxFiles, or 1 if CurrentFile is equal to MaxFiles. All properties of this class are specified in the constructor; there is no way to change them dynamically. Caveat: If two instances of LogFileTraceWriter are created with the same path and dirNameBase, and useSameDir is true, they may write to the same file. Note Example The following code instantiates a LogFileTraceWriter that will create log files called “MyLog01.log” through “MyLog12.log”. Each file will grow to approximately 100K bytes in size before the next file is created: LogFileTraceWriter out = new LogFileTraceWriter ( “MyLog”, “log”, 12, 100 * 1024 ); will create a log file TraceWriter which will rotate traces to 12 files from Mylog01.log and Mylog12.log with a file size of 100 KBytes. By default the tracing is set to the HIGHEST_LEVEL. The following code constructs a LogFileTraceWriter which stores the log files in the path “c:/LogFiles” in a sub directory, “Run”. The files will be named MyLogXX.log. The number of rotating files will be 12 with a size of 100 KB. The same directory gets used for each instance of the application. LogFileTraceWriter out = new LogFileTraceWriter (“c:/logFiles”, “Run”, “MyLog”, “log”, 12, 100*1024, true); See Also Trace, on page 714 Cisco Unified JTAPI Developers Guide for Cisco Unified Communications Manager, Release 15 and SUs 702 Cisco Unified JTAPI Alarms and Services LogFileTraceWriter