Log Files and Unknown Errors (Magic xpa 4.x)
Magic xpa works with various log files.
There are three types of logs used by the broker. The first two files have Log parameters:
-
Requester log – Displays low-level activities, such as TCP/IP, threads, events, connect, send and receive. This log is defined in the Mgreq.ini file in the Scripts folder. Some of the settings aren’t relevant to all the modules. For example, the Priority entry is relevant only to requesters.
-
Broker log – Displays high-level broker activities of the broker such as initialization, receiving requests, locating enterprise servers, and sending enterprise servers to requesters. This log helps you understand whether or not the broker accepted a request, and what was done with the request. This log is defined in the Mgrb.ini file.
-
BrokerActivity.log – This log is issued from the broker and is not related to any INI file, registers significant broker activities, such as startup and shutdown of the broker and enterprise servers. This log is by default located in the Magic xpa installation directory. This is not supported for the space middleware.
Unexpected Errors
Errors that are not listed in the documentation, such as –145, are best handled by using the log file from the mgreq.ini file. This log file can show for example problems with host name resolving, which mostly cause these errors to be displayed.
It is important to know the difference between errors from the Web server (which are not displayed in the blue/aqua error page of Magic xpa) to errors of Magic xpa. Errors of the Web server can be a missing requester, insufficient rights, etc.
The default output folder is the Logs folder in the installation's root folder.
|
|
|
Log4net
|
ASP .NET Requester log
|
This log is defined in the web.config file in the Scripts folder.
|
Space Monitor application log
|
This log is defined in the MgGSMonitor.exe.config configuration file in the GigaSpaces-xpa\Monitor folder. Since version: 3.1
|
Log4j2
|
Space engines and Apache Tomcat requester logs
|
Display space-related activities. These log files are defined in the log4j2.xml file in the GigaSpaces-xpa\config folder. The log4j2.xml file will not exceed 10MB (Since version: 3.2).
|
Log4j2 Infrastructure
The logging configuration is set in the <Magic xpa installation>\GigaSpaces-xpa\config\log4j2.xml file. For more information, see http://logging.apache.org/log4j/2.x/manual/index.html.
Logging Level
In the log4j2.xml file, you can change the value of the logging level in the <level value="xxx"/> tag to any of the following values:
|
static Level
|
ALL
|
The ALL has the lowest possible rank and is intended to turn on all logging.
|
static Level
|
DEBUG
|
The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
|
static Level
|
ERROR
|
The ERROR level designates error events that might still allow the application to continue running.
|
static Level
|
FATAL
|
The FATAL level designates very severe error events that will presumably lead the application to abort.
|
static Level
|
INFO
|
The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
|
static Level
|
OFF
|
The OFF has the highest possible rank and is intended to turn off logging.
|
static Level
|
TRACE
|
The TRACE Level designates finer-grained informational events than the DEBUG
|
static int
|
TRACE INT
|
TRACE level integer value.
|
static Level
|
WARN
|
The WARN level designates potentially harmful situations.
|
*Table replicated from: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.
You can change the logging level during runtime. This is especially useful when deploying your projects.
Any change made in the log level during runtime is effective immediately and does not require an application restart.
The process ID is automatically embedded in the log file name.
Each Magic xpa server has one log file.
The following system properties are required. (They are set by the installation.):
-Dcom.gigaspaces.logger.RollingFileHandler.filename-pattern={homedir}\..\Logs\{date,yyyy-MM-dd~HH.mm}-gigaspaces-{service}-{host}-{pid}.log -Dcom.magicsoftware.xpa.home=%EngineDir% -Dlog4j.configurationFile=%EngineDir%\GigaSpaces-xpa\config\log4j2.xml
-
<installation folder>\Magic.ini (for Java code executing under the Magic xpa server): [MAGIC_JAVA]JVM_ARGS=
-
<installation folder>\GigaSpaces-xpa\bin\setenv.bat (for Magic xpa Java classes packaged in Magic xpa JAR files and executed by GigaSpaces' Grid Service Components)
When the space is deployed on multiple servers, it is recommended to direct all log files into one central location, such as the Logs folder of one of the machines (for example, ServerA, below):
-
In the <installation folder>\Magic.ini and <installation folder>\GigaSpaces-xpa\bin\setenv.bat files, modify filename-pattern={homedir}\.. to filename-pattern=\\ServerA\MSE\Magic xpa 3.2\.
(In this and in the following examples, MSE should be defined in a shared location on ServerA).
-
In the <installation folder>\GigaSpaces-xpa\config\log4j2.xml file, under the <Appenders> element, search for ${sys:com.magicsoftware.xpa.home} and replace it with \\ServerA\MSE\Magic xpa 3.2\.
-
In the <installation folder>\GigaSpaces-xpa\bin\setenv.bat file, define the set PROJECTS_STARTUP_XML= entry to \\ServerA\MSE\ProjectsStartup.xml.
\\ServerA\MSE\ProjectsStartup.xml:
<Project Name="GSTest"
StartApplication=\\ServerA\MSE\Magic xpa 3.2\GigaSpaces-xpa\test\GSTest.ecf
CMDLineArgs="/GeneralErrorLog=\\\\ServerA\\MSE\\Magic xpa 3.2\\Logs\\''GSTest''_Errors_[%HostName%_%PID%].Log
/[MAGIC_LOGGING]ExternalLogFileName=\\\\ServerA\MSE\\Magic xpa 3.2\\Logs\\''GSTest''_[%HostName%_%PID%].Log
Log4net Infrastructure
You can change the value of the logging level in the <level value="xxx"/> tag to any of the values listed below (https://logging.apache.org/log4net/release/manual/introduction.html). The logger will output the messages with the levels higher or equal to the one defined.
In the log4net section:
-
The <file value> key defines log file path and name.
-
The <conversion pattern> key defines the output message format.
-
The <filter type> section defines the level range filter. It tells the system to only log entries that are inside of the specified range. This range is inclusive.
Log File Troubleshooting