This tutorial will demonstrate how to use Log and Log Configuration Tab on Agent Control Board.
Log tab ↔The log tab is used to show the log file from the Agent. The physical log file is created and kept in the local folder of the Agent and we need to view the file in Salesforce because we don’t want to get into the Agent Server. Sometimes we don’t have any access from the customer to access the Agent-Server and thus it is not possible to read the log file to analyze the error. Therefore we want to have the possibility to get the log file and show on the Log tab in Salesforce.
In the section Logs, we store the error line from the log file into the ilog2 table. The button Refresh means that we reread the data from the table to see the new entries which were pushed from the Agent on a regularly based through a scheduler. The Agent push using the REST api to insert new entries into the table ilog2__c and thus we need to do the Refresh to see new content. The button ‘Reread from Agent’ is to actively read the new log entries without waiting for the scheduler. This is needed when we urgently need to see the latest log entries and cannot and don’t want to wait until the scheduler push the new entries into the table ilog2__c.
In the section Logs File, we show the file which we import from the Agent. We have discussed the solution that the Agent creates and updates e.g. append new entries into the active log file. But this is not possible because there is no Salesforce API that can append new lines to the file. The Salesforce API can only create new or replace the existing file. Therefore we cannot apply the solution to do from Agent using a scheduler as we can do for the ilog2__c. The new idea is to let the user click on the button ‘Import from Agent’ and call an API from the Agent which shows the currently active file. Then the currently active file is imported again and will overwrite the last one which we see on the screen. If the currently active file is enrolled in an archived state and we have a new current active file then this file is imported and has a new name. The previous current file becomes an archived file with that name.
If for a long time the user has not imported any log files then he will have a log and he need not only the possibility to import the currently active file but also the other archived files. The API needs to provide only files that have not been imported already to Salesforce. The API has to import the currently active and those files which are still not imported to Salesforce.
Logging API Functionality:
We’re using Logback as the controlling framework for Logs. Logs will be segregated into mainly two categories.
1. System Logs – Log file name is going to be SYSTEM-LOG.txt and it will include all the system maintenance API, framework logs.
2. Business API Logs – Log file name would be formed with this format <IntegrationName>-<Hash generated based on Integration ID & Instance URL concatenated together>.txt. These logs will include the details about the Business APIs.
At any point in time, we can update the Logging configuration through the APIs build in the system. There will be a default Logging setting which will remain active in case of any starts or restarts of the Agent service. This Logging is not present in the DB rather in the logback.xml. At any point, if we want to create a logging profile, we can do so using the APIs built and described below. Then to activate we need to use activate API.
- Logs Section in which the user can able to see all logs related to selected Integration.
- Active Log File in which the user can able to see all active log files related to selected integration.
- Backup Log File Section in which the user can able to see all Backup logs file related selected Integration.
- System Backup Log File in which the user can able to see all system backup log files related to selected integration.
Log Configuration Tab ↔
Log Profile Name:
User can select the existing logfile from this dropdown. There are three default profiles available. If users want to create new then you can clone it. (by click on the clone button)
This is the file name. where the user can see the selected log file name.
This is an autogenerated field. The user can not edit this field. It will display the Id of Log.
Log Line Entry Format:
What kind of msg is going to proceed? This field is not going to change by anyone. For every profile, it’s going to be the same.
Max. Total File Size (current + backup file)
This file size shows us how much max file size takes on the server? 1 = 1GB. Means Agent keeps running and generating a log file every day. Every day there is a new log file. And an old log file is archived and stored in the backup folder. All the current and backup files should not cross 1GB. once it crosses our function will start deleting the old log file which was pretty old it means the oldest file deleting first.
Max Days To Keep File
As agent keeps on running and generating a new log file every day. There should be a limit on how long the user kept this log file even if that log files are small but the user doesn’t want to keep that file which we don’t require that is what specified by this setting any of the old log file or archived log file is kept in the system for 60 days. After 60days it will be deleted automatically.
Max. File Size:
This property says that how much particular log file can be available at any point of time when the system creates a log file will verify whether file size getting more than some MB’s and here the specified file size is in MB, not GB. We log a lot of files but in case of huge file size, we required to check by the system. What system will do as soon as it will hit the limit of 1MB it will archive that file. And create a new file we have 2 types of a rotation policy for any log file:
- Based on time
- Based on size
Whatever has been reached earlier a log file is being rooted because of that. If the file is not beyond 1MB and the next day is started then we will get the new log file. If the file size has reached 1MB on the same day. For example, In 1HR user did so many transactions somehow log file size is beyond 1MB then the system will create a new log file for further transaction.
Rolling strategy means Strategy to use to switch to a new log file or rotation of log file. There is a different strategy like daily, weekly, monthly, yearly. Let’s take an example of weekly: If we are getting less log msg then-current log file is very small. In such a scenario it is ideal that we should keep the Rolling strategy is weekly.
- Daily: At every midnight 12 new log file is created. If we are getting a lot of log msg then-current log file is very huge
- Weekly: after 7days
- Monthly: after a month
- Year: After a year a new log file is generated.
Backup File Format
Says what kind of zipping gzip. when the system sees gz then it will unzip to compressed and zip file.
Agent Trace Level
Agent Trace Level is a picklist. It contains five different levels with different flexibility of showing a message log.
- Error: Only the error message log will show when we select Error.
- Info: Info message log as well as error message log will show when we select Info.
- debug: when we enable debug, info, error message log will show.
- trace: when we select trace error, info, debug and trace message log will show
- all: all msgs are logs
Framework Trace Level
When Third-party API is used their log is also managed by them only. So Framework Trace Level property helps us to log of third party log files. There are 5 different levels as:
Where do you want to save this log file inside the server? That is being configured by this file location. This file location specifies by active file location.
Backup File Location
This normal nomenclature. This file location specifies by active file. All active files that have rotated and back up are stored in this location.
Name of your active profile.
This will indicate that a particular profile is active or not
Summary Now user learned how log and log configuration tabs work and why these all fields for?