Enabling Logging in SMath Studio: Difference between revisions

From SMath Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 141: Line 141:


: '''Why disable logging?''' Leaving logging active causes the <code>Solver.log</code> file to grow uncontrolled over time, consuming disk space and potentially slowing down file operations. Restoring the default (commented) state is a best practice once diagnostics are complete.
: '''Why disable logging?''' Leaving logging active causes the <code>Solver.log</code> file to grow uncontrolled over time, consuming disk space and potentially slowing down file operations. Restoring the default (commented) state is a best practice once diagnostics are complete.
[[Category:Manual]]
[[Category:SMath Studio]]

Latest revision as of 12:27, 26 August 2026

Enabling Logging in SMath Studio

When you experience a challenge or unexpected behavior in SMath Studio, enabling built-in logging helps diagnose the issue. The log file captures detailed trace information that you (or your software vendor) can use to identify the root cause.

Prerequisites

Locate where SMath Studio is installed:

  • Per-machine installation: C:\Program Files (x86)\SMath\ (or similar)
  • Per-user installation: your user profile folder (e.g., C:\Users\<YourName>\...)

Steps

1. Close all SMath Studio instances

Make sure every SMath Studio process is closed before editing the configuration file.

2. Open Solver.exe.config for editing

Navigate to the SMath Studio installation folder and open the file Solver.exe.config with a text editor (e.g., Notepad).

Note: Administrator permissions may be required to modify this file if SMath Studio was installed per-machine. Right-click your text editor and choose Run as administrator.

3. Uncomment the logging blocks

The file contains two blocks that are commented out by default. You need to remove the XML comment markers (<!-- and -->) so that the configuration becomes active.

Below is the default (commented) content — both the <source> elements and the <add> listener element are wrapped in comments:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.diagnostics>
    <sources>
      <!--
        The name attribute of <source> element is split by dot in order to build the hierarchy of sources for loggers.
        The source with name="root" defines the root in the hierarchy.
        Use attribute newSwitch="true" in order to redefine the switch for the related source and its descendants.
        Use attribute newListeners="true" in order to redefine the listeners for the related source and its descendants.
        Supported values of attribute switchValue in order of verbosity: "Off" (default), "Critical", "Error", "Warning", "Information", "Verbose"
      -->
      <!--
      <source name="root">
        <listeners>
          <add name="file" />
        </listeners>
      </source>
      <source name="SMath.Controls" newSwitch="true" switchValue="Error" />
      <source name="SMath.Environment" newSwitch="true" switchValue="Error" />
      <source name="SMath.Document" newSwitch="true" switchValue="Error" />
      <source name="SMath.Manager" newSwitch="true" switchValue="Error" />
      <source name="SMath.UI" newSwitch="true" switchValue="Error" />
      -->
    </sources>
    <sharedListeners>
      <!-- Writes trace to file -->
      <!--
      <add name="file"
           type="SMath.Manager.Logging.FileTraceListener, SMath.Manager"
           traceOutputOptions="DateTime,ProcessId,ThreadId"
           initializeData="%APPDATA%\SMath\Solver.log"/>
      -->
    </sharedListeners>
    <trace autoflush="true" indentsize="4" />
  </system.diagnostics>
</configuration>

Uncomment the two XML blocks that contain actual configuration (the <source> elements and the <add> listener element), while keeping the description comment (the first <!-- ... --> block that contains explanatory text).

After uncommenting, the file should look like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.diagnostics>
    <sources>
      <!--
        The name attribute of <source> element is split by dot in order to build the hierarchy of sources for loggers.
        The source with name="root" defines the root in the hierarchy.
        Use attribute newSwitch="true" in order to redefine the switch for the related source and its descendants.
        Use attribute newListeners="true" in order to redefine the listeners for the related source and its descendants.
        Supported values of attribute switchValue in order of verbosity: "Off" (default), "Critical", "Error", "Warning", "Information", "Verbose"
      -->
      <source name="root">
        <listeners>
          <add name="file" />
        </listeners>
      </source>
      <source name="SMath.Controls" newSwitch="true" switchValue="Error" />
      <source name="SMath.Environment" newSwitch="true" switchValue="Error" />
      <source name="SMath.Document" newSwitch="true" switchValue="Error" />
      <source name="SMath.Manager" newSwitch="true" switchValue="Error" />
      <source name="SMath.UI" newSwitch="true" switchValue="Error" />
    </sources>
    <sharedListeners>
      <!-- Writes trace to file -->
      <add name="file"
           type="SMath.Manager.Logging.FileTraceListener, SMath.Manager"
           traceOutputOptions="DateTime,ProcessId,ThreadId"
           initializeData="%APPDATA%\SMath\Solver.log"/>
    </sharedListeners>
    <trace autoflush="true" indentsize="4" />
  </system.diagnostics>
</configuration>
Tip: Only uncomment XML elements that contain nested XML structures (the <source> and <add> elements). Keep pure description text as comments.

4. Save the file

Save the modified Solver.exe.config file and close the text editor.

5. Reproduce the issue

Open SMath Studio and perform the steps that triggered the problem. The application will now write trace output to the log file.

6. Retrieve the log file

Navigate to the log folder (no administrator access required): %APPDATA%\SMath\

To open it quickly, press Win+R, type %APPDATA%\SMath\, and press Enter.

The log file is Solver.log.

7. Examine the log

  1. Open Solver.log in a text editor.
  2. Scroll to the last lines — the most recent entries are where the relevant challenge is typically recorded.
  3. Either:
    1. Identify the error/exception message yourself, or
    2. Attach the log file (or its meaningful section) to a support request to your software vendor.

8. Disable logging (recommended when finished)

After the issue is resolved or the log has been shared:

  1. Close SMath Studio.
  2. Re-comment the two XML blocks in Solver.exe.config (restore the original state shown in Step 3).
  3. Save the file.
  4. Optionally delete %APPDATA%\SMath\Solver.log to clean up.
Why disable logging? Leaving logging active causes the Solver.log file to grow uncontrolled over time, consuming disk space and potentially slowing down file operations. Restoring the default (commented) state is a best practice once diagnostics are complete.