Manage log files
This topic describes the log files generated during synchronizations, that record the activity of the various connection runs.
Log file names
During installations and upgrades, three log files are generated in the <MFConnect_installdir/AppData folder: log4j2.xml, log4j2-template.xml, and logback-template.xml.
The default log4j2.xml file performs error logging, the lowest logging level.
Under normal circumstances, none of these log files are required to run a synchronization, and they may safely be removed. If there are no xml files in the AppData folder, nothing is logged in the logs folder. This may be useful if you have disk space constraints.
In the utilities subfolder, three additional log files are generated, corresponding to the logging level:
- For Windows: log4j2.error.win.xml, log4j2.info.win.xml,and log4j2.trace.win.xml.
- For Linux: log4j2.error.ux.xml, log4j2.info.ux.xml,and log4j2.trace.ux.xml.
Log file storage location
The actual logs with the runtime information are stored in the <MFConnect_installdir/AppData/logs folder. Due to the large volume of the log information generated, the log files are archived in the log folders as .gz or .zip files.
To change the default log file storage location:
Open the log4j2.xml file in the <MFConnect_installdir/AppData folder.
Make the following change: <Property name="logsDir">../../AppData/logs</Property>
Define the logsDir parameter.
Note: If you change the log location, scheduled nightly purges do not delete these logs. We do not recommend retaining historical logs, since you can retrieve all significant information from the audit and data folder backups.
If you need to store the logs on a drive other than the local C drive, periodically copy the contents of the backup folder to the new storage location. This folder's contents include a backup of the database and a denormalized flat file representation of the audits. The copied files provide you with a complete audit of your synchronization.
Logging levels
Connect supports three levels of logging:
Log level | Details | Relevant log file |
---|---|---|
Error |
The lowest logging level, that produces the least amount of information. This is the default level as generated by the installer. Disk space usage: Low |
|
Info |
The average logging level. It reports all of the runtime information about the synchronizations. Disk space usage: Medium |
|
Trace |
The highest logging level. It reports all of the runtime information about the synchronizations, including REST API calls to the endpoint systems, raw data returned, and error messages with a full stack trace. This level is useful for a temporary trace, typically in conjunction with a support engineer, to capture the information required to raise defects. After the logs are collected, you are typically requested to run a purge. For details, see Batch utility scripts. Disk space usage: High. This level significantly increases the amount of disk space utilized. Therefore, it should only be used for a short, controlled period of time. |
|
The log level is controlled by the type of log4j2.xml file that is stored in the c:/program files/micro focus/connect/AppData
folder. For details, see Enable logging.
Enable logging
Logs are only generated when the log4j2.xml file is detected in the <MFConnect_installdir/AppData folder. By default, this file is added to the AppData folder during installation at the error logging level.
To enable logging or to modify a logging level:
- Decide on a logging level, as described in Logging levels.
- Copy the relevant file from the <MFConnect_installdir/utilities folder to the AppData folder. For example, to enable trace logging on a Windows machine, copy log4j2.trace.win.xml to the AppData folder.
- Rename the file that you copied over, to log4j2.xml.
- Run the synchronization.
Turn off logging and remove logs
This section describes how to suspend the generation of logs and remove existing logs, in order to clear disk space.
To turn off logging and clear the disk space:
- In the <MFConnect_installdir/AppData folder, delete the log4j2.xml file.
- In the <MFConnect_installdir/AppData/logs folder, delete all .xml files with a log prefix. Use this expression:
log*.xml
. Also delete any .gz or .zip files. -
Run the script, Purge, as an administrator. For details, see Batch utility scripts. If the Purge script is run on a scheduled basis, all logs are automatically deleted based on that schedule.
Tip: It is recommended that you run the purge as a nightly task. For details, see Purge files on Windows as a nightly task.
Purge files on Windows as a nightly task
By default, all logs and audit reports are purged every 24 hours. The older records are saved as .csv files. On-premises users can delete these file manually. SaaS users can configure the system to remove these files at a given interval.
This section describes how to manually create a scheduled task for purging data on a Windows machine.
To set up the nightly task on Windows:
- From the Start menu, search for Task Scheduler. Right click and select Run as administrator.
- In the right pane, click Create Basic Task.
- In the Create Basic Task, provide a name and description for the task. Click Next.
- In the Trigger page, select Daily. Click Next.
-
In the Trigger > Daily page:
- Provide a start date and time. Choose an off-peak time when system usage is low.
- Enter Recur every 1 days.
- Click Next.
- In the Action page, select Start a program. Click Next.
-
In the Action > Start a Program page:
- Enter mfcpurge.bat into the Program/script box. Do not include the full path.
- In the Start in (optional) box, enter the complete path to the <MFConnect_installdir/Utilities folder, without quotations.
- Click Next.
- In the Finish page, enable the option: Open the Properties dialog for this task when I click Finish. Click Finish.
- In the Purge Properties dialog box, click Change User or Group.
- In the Select User or Group dialog box, enter SYSTEM into the Enter the object name to select box. Click Check Names. SYSTEM becomes underlined. Click OK.
- In the Connect Purge Properties dialog box, enable Run with the highest privileges. Click OK.
The purge task is now configured to run nightly.
For details, see Batch utility scripts.
Gather debug information
This section describes how to gather debug information to submit to technical support.
By default, the Error logging level is used. To debug an issue, you may need a higher level of logging known as the Trace level. For details, see Logging levels.
To gather a trace level logs and their associated data:
- Connect to the Connect server machine as an Administrator.
- Open an escalated (Run as Administrator) command prompt.
- Change directory to the <MFConnect_installdir\Utilities directory.
- Run the StopAllConnections script to stop all connections, or log into the machine and manually stop all connections. For details, see Start or stop connections.
- Run services.msc to open the Services manager and stop the Connect Web Server service.
- Delete log4j2.xml file typically under <MFConnect_installdir\AppData.
- Copy log4j2.trace.win.xml from <MFConnect_installdir\Utilities to <MFConnect_installdir\AppData.
- Rename <MFConnect_installdir\AppData\log4j2.trace.win.xml to log4j2.xml.
- In your escalated command prompt: Run <MFConnect_installdir\Utilities\mfcPurge.bat
- Log in to Connect.
- Reproduce the issue that you want to debug, using only the affected data source or connection. If you are debugging a connection, we recommend using the Run one iteration option.
- Run services.msc to open the Services manager and stop the Connect Web Server service.
-
Create a zip file containing the entire contents of the following directories:
<MFConnect_installdir\AppData\data
<MFConnect_installdir\AppData\logs
- Provide the above zip file to OpenText support.
Revert to the default logging level
Running iterations with the of Trace logging level is not recommended for ordinary usage, as it consumes a large amount of disk space. This can use up your available storage, causing system instability. Therefore, we recommend reverting back to Error logging level after submitting your trace files to support.
To revert to the Error logging level:
- Delete <MFConnect_installdir\AppData\log4j2.xml
- Copy <MFConnect_installdir\Utilities\log4j2.error.win.xml to C:\Program Files\Micro Focus\Connect\AppData\
- Rename <MFConnect_installdir\AppData\\log4j2.error.win.xml to log4j2.xml.
- Run <MFConnect_installdir\Utilities\mfcPurge.bat as an administrator.
- Start any required connections which were stopped during the above steps.