TAFC Logger

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 19

TAFC Logger

Introduction
This User guide describes the purpose and usage of TAFC Logger.

Currently, there are a variety of different logging subsystems across TAFC. They all have different APIs,
setup and functionality. This common library framework resolves the problem of multiple APIs.

Introduced in TAFC R12, the TAFC logger is designed to be both component based and generic
framework for logging.  Having a single library allows logging to be controlled across entire TAFC. The
library provides all necessary wrappers for C and jBC.
Assumptions
The executor of this test plan should be familiar with jBASE / TAFC.

A working knowledge of TAFC Initialisation and its configuration file is assumed.


Overview
TAFC logger can be used in some or all of the components of TAFC release package. TAFC logger uses
the file tafc.ini of its CONTEXT, to describe the Logging Framework functionality with a separate section
called “[logger]”.  At present Logging Framework is provided for the list of components given below. Each
component has its own TAFC component name defined, and this component name is used to specify
component level logging functionality.

  TafcComponent Component Logger Section Name

1 jCF jCF

(Note -jCF is not a Component but a Library)

2 InitChecks initchecks

3 jAGENT Agent

4 TAFC programs jBC

 Default location for Tafc logger to generates log files is $TAFC_HOME/log/$TAFC_CONTEXT

 Default filename of a log file is as below:-

<TafcComponentName.>.<hostname>.<user name>.log.<severity level>.<date>.<time>.<pid>

By default TAFC logger is enabled, and can be enabled or disabled by setting variable “LOGGING” to
“FILE” or “OFF”. This logging variable can be set for all the TAFC Components using [logger] section and
may be overridden by logger variables for a specific TAFC component such as agent or jBC.

 
Logger configuration
Logger can be configured with a section in its tafc.ini file. [Select tafc.ini depending on TAFC_CONTEXT].
Logger can also be configured for both common logging framework and component specific logging
framework.

Common Logging framework section name: - logger, written in tafc.ini file as “[logger]”. Any variables
under this library will be considered for the entire logging framework unless it is overridden in its
respective component specific framework.

TAFC Logger Variables


List of logging framework variables given below, can be used to configure TAFC Logger.

LOGGING
When this variable is set, the logger is on and has default enough information to run. This variable
defines a message storage type.

For example, a configuration for the file message storage:

LOGGING=FILE.

Defaults value is FILE if not defined.

LOG_DIR
This variable sets a directory where log files are written.

LOG_DIR=directory

For example, LOG_DIR=$TAFC_HOME/log/$TAFC_CONTEXT

Defaults value is $TAFC_HOME/log/$TAFC_CONTEXT if not defined.

LOGTOSTDERR
This variable defines whether log messages go to stderr instead of a log file.

LOGTOSTDERR=value

Possible values (not case sensitive):

 1, yes, true – flag is on

 0, no, false – flag is off [default]

ALSOLOGTOSTDERR
This variable defines whether log messages go to stderr additionally to a log file.

ALSOLOGTOSTDERR=value

Possible values (not case sensitive):

 1, yes, true – flag is on


 0, no, false – flag is off [default]

STDERRTHRESHOLD
This variable defines whether log messages go to stderr depending of the severity. All messages having
at a level great or equal this value will be also sent to stderr.

STDERRTHRESHOLD=value

Allowed values (not case insensitive): "INFO" (or 0), "WARNING" (or 1), "ERROR" (or 2), "FATAL" (or 3).

Defaults value is ERROR if not defined

LOG_PREFIX
This variable defined where log messages are depended with a prefix.

LOG_PREFIX=value

Possible values (not case sensitive):

 1, yes, true – flag is on [default]

 0, no, false – flag is off

Log line prefix format

Log lines have this form:

    Lmmdd hh:mm:ss.uuuuuu pid file:line] msg...

Where the fields are defined as follows:

 “L” – A single character, representing the log level (for example, 'I' for INFO)

 m – The month (zero padded, for example May is '05'

 dd – The day (zero padded)

 hh:mm:ss.uuuuuu – Time in hours, minutes and fractional seconds

 pid – The space-padded processed ID

 file – The file name

 line – The line number

 msg – The user-supplied message

Example:

  I1103 11:57:31.739339 24395 main.cpp:2341] Command line: ./some_prog

  I1103 11:57:31.739403 24395 main.cpp:2342] Process id 24395

LOGBUFSECS
This variable sets the maximum number of seconds which logs may be buffered for.

LOGBUFSECS=value_in_seconds [default = 30]


MINLOGLEVEL_FILE
This variable defines log suppression level: messages logged at a lower level than this are suppressed.

MINLOGLEVEL_FILE=value

Allowed values (case sensitive): "INFO" (or 0), "WARNING" (or 1), "ERROR" (or 2), "FATAL" (or 3).

Default value is INFO.

MINLOGLEVEL_EVENTVIEWER
This variable is used if users want log messages to be sent into Windows Event Log (viewed with Event
viewer).

LOG_TO_SINGLE_FILE
This variable is used to specify a single file per severity. The supported severity are INFO,
WARNING,ERROR and FATAL. The filename format is <Component>.<System Nmae>.log.<Severity>. It
can be enabled in [LOGGER] section of the tafc.ini file by setting the variable as follows:

LOG_TO_SINGLE_FILE=true

Date can be appended to the filename by setting the variable as follows:

LOG_TO_SINGLE_FILE=date

LOGFILE_COMPONENT_NAME
This variable is used to specify a single component name for all the log files. It can be done by setting
the variable in the [LOGGER] section of the tafc.ini file as follows:

LOGFILE_COMPONENT_NAME=<Component Name>

Example:

LOGFILE_COMPONENT_NAME=T24

ENABLE_WRITE_TO_STDERR
This variable enables writing to stderr. If it is not set in [LOGGER] section of tafc.ini file, then it is
recommended to it will turn off writing to stderr.
Sample Logging Screenshots

Screenshot for some sample log files on Windows/UNIX


It not mandatory that link files like “initchecks.INFO”, “initchecks.WARNING” and “initchecks.ERROR” are
always available, They are not available any version of windows below WINDOWS VISTA.

Screenshot of the actual file


Screenshot of the EventViewer window
Sample scenarios
By default logging is enabled for all the components that are using new TAFC logging framework.

 Disable Logging for one specific component and enable for remaining TAFC components.
[initchecks]
LOGGING=OFF
/// Below section is optional
[logger]
LOGGING=FILE

 Enable Logging for one specific component and disable for remaining TAFC components.
[initchecks]
LOGGING=FILE
[logger]
LOGGING=OFF

 Set minimum log level for initchecks to INFO and minimum log level for rest of the components
to WARNING. (we need not set LOGGING as it is enabled by default)
[initchecks]
MINLOGLEVEL_FILE=INFO
[logger]
MINLOGLEVEL_FILE=WARNING
JBC API for TAFC logger
JBC API is a wrapper for TAFC logger that enables the JBASE BASIC code to use TAFC logger library. It
works similar to TAFC logger library and gives customer a function to generate logging at different levels.

TAFC logger can use the same set of logger variable in tafc.ini. We can however configure the JBC logger
variable using “[jBC]” section.

Logging happens at different level namely:

 TAFC_LOG_INFO

 TAFC_LOG_WARNING

 TAFC_LOG_ERROR

 TAFC_LOG_FATAL (This will make Application to terminate)

JBC API Logger Function


Logger(VAR Category, VAR Severity, VAR Message)

Sample Program How to Use Logger Function-

Sample.b

INCLUDE JBC.h

Logger("CUSTOMER", TAFC_LOG_INFO, "Test Program JBC-CUSTOMER")

Logger("ACCOUNT", TAFC_LOG_WARNING, "Test Program for JBC-ACCOUNT")

Logger("FUND-TRANSFER", TAFC_LOG_ERROR, "Test Program for JBC-FUND-TRANSFER"

Commands used to compile and generate executables

This Program will produce a list of log files as shown below:

List of LOG Files generated


Contents of INFO Log File

Contents of WARNING Log File

Contents of ERROR Log File

You can define jBC section for Logger variables in tafc.ini file as shown below-
Note: The minimum log level for jBC is ERROR superceding that of the generic log level. Therefore errors
of  level ERROR and above would be logged for any jBC code.

There could be individual sections within jBC for each product such as CUSTOMER , ACCOUNT OR
FUNDSTRANSFER. A sample is shown below

[CUSTOMER]

MINLOGLEVEL_FILE=INFO

[ACCOUNT]

MINLOGLEVEL_FILE=ERROR

[FUND-TRANSFER]

MINLOGLEVEL_FILE=WARNING
Detailed information of the event from the Event Viewer
Window
Log Name:      Application

Source:        libTAFClogger

Date:          1/20/2012 3:13:19 PM

Event ID:      1

Task Category: (1)

Level:         Error

Keywords:      Classic

User:          ASIA\dhanyaj

Computer:      maad11012639.asia.temenosgroup.com

Description:

ERROR - E0120 15:13:19.386320  5624 TAFC_InitCheck.cpp:653] [TAFC] Stop database on TIC Error

Event Xml:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

  <System>

    <Provider Name="libTAFClogger" />

    <EventID Qualifiers="49152">1</EventID>

    <Level>2</Level>

    <Task>1</Task>

    <Keywords>0x80000000000000</Keywords>

    <TimeCreated SystemTime="2012-01-20T09:43:19.000000000Z" />

    <EventRecordID>4110</EventRecordID>

    <Channel>Application</Channel>

    <Computer>maad11012639.asia.temenosgroup.com</Computer>

    <Security UserID="S-1-5-21-839522115-1645522239-725345543-23040" />

  </System>

  <EventData>

    <Data>E0120 15:13:19.386320  5624 TAFC_InitCheck.cpp:653] [TAFC] Stop database on TIC Error

</Data>

  </EventData>
</Event>
Screenshot of log files generated
Contents of INFO File:

Contents of WARNING File:

Contents of ERROR File:

More sample scenarios are given in Appendix A.

Windows Event Log files


The Windows Event Log Files generated for different values of MINLOGLEVEL_EVENTVIEWER variable for
different jBC components:

MINLOGLEVEL_EVENTVIEWER=INFO

This is not recommended as users end up receiving thousands of log messages in Windows event log and
it will fill up.

MINLOGLEVEL_EVENTVIEWER=WARNING

 
MINLOGLEVEL_EVENTVIEWER=ERROR

Logs only ERROR

Note:  The Windows Event Logs generated here are based on the values of tafc.ini and Logger program
provided here. Other components  may be logged on changing the parameter values of Logger function
and jBC components.

 
Appendix A:
Sample Log Details:
 

SECTIO VARIABLES VALUES LOG FILES CREATED


N

[agent] LOGGING FILE INFO, WARNING

  STDERRTHRESHOLD FATAL

MINLOGLEVEL_EVENTVIEWER INFO

[jbc] LOGGING FILE INFO, WARNING, ERROR

  MINLOGLEVEL_FILE INFO

ALSOLOGTO_EVENTVIEWER TRUE

 
 

SECTI VARIABLE VAL LOG FILES CREATED WINDOWS


ON S UES EVENT LOG
STATUS

[logger LOGGING OFF - ERROR - E0127


] 1:02:09.852566 
1796
tafc_logger_c_a
[jBC] LOGGING FILE jBC.MAAD11012639.dhanyaj.log.ER pi.cpp:33]
ROR.20120127-110209, sample.b:5
jBC.MAAD11012639.dhanyaj.log.IN [FUND-
FO.20120127-110209, TRANSFER] Test
jBC.MAAD11012639.dhanyaj.log.W Program for
ARNING.20120127-110209 JBC-FUND-
TRANSFER

[CUST MINLOGLEV INFO INFO


OMER] EL_FILE
[ACCO MINLOGLEV ERRO NOT LOGGED
UNT] EL_FILE R

[FUND- MINLOGLEV WAR INFO, WARNING, ERROR


TRANS EL_FILE NING
FER]

 
 

SECTI VARIABLES VAL LOG FILES CREATED WIND


ON UES OWS
EVEN
T LOG
STAT
US

[logger LOGGING OFF - NOT


] LOGGE
D

[jBC] LOGGING OFF CUSTOMER.MAAD11012639.dhanyaj.log


.ERROR.20120127-111835,
CUSTOMER.MAAD11012639.dhanyaj.log
.INFO.20120127-111835,
CUSTOMER.MAAD11012639.dhanyaj.log
.WARNING.20120127-111835

ALSOLOGTO_EVE TRUE -
NTVIEWER

[CUST MINLOGLEVEL_FI INFO INFO


OMER] LE

[ACCO MINLOGLEVEL_FI ERR NOT LOGGED


UNT] LE OR

[FUND- MINLOGLEVEL_FI WAR INFO, WARNING, ERROR


TRANS LE NING
FER]

You might also like