Skip to content

Logging and Debugging

Amin Torabi edited this page Sep 23, 2024 · 2 revisions

Logging in T-Route

T-Route provides detailed logging capabilities to monitor the execution of the model and track the performance of various functions. By logging key events, the model helps users identify potential issues, understand runtime behavior, and optimize performance.

Key Features of T-Route Logging:

  • Function Execution Monitoring: Logs the execution of all major functions, including initialization, data loading, routing computations, and finalization processes.
  • Timing Information: Captures the time taken by each function, enabling users to pinpoint performance bottlenecks and optimize model efficiency.
  • Detailed Events: Records detailed messages about the execution flow, including warnings and errors, which are crucial for debugging and model validation.

Configuring Logging

To enable logging and save the logs to a specific directory, you need to configure the log_directory parameter in the YAML configuration file. By default, logging is active, but the logs are only displayed on the console. If you want to store the logs for future reference or detailed analysis, follow these steps:

  1. Uncomment and Set log_directory:

    Uncomment the log_directory line and specify the path where you want the log files to be saved. For example:

    image

    log_directory: logs/

    This configuration will create a directory named logs/ in your working directory, and all log files will be saved there.

  2. Log Level Control:

    You can adjust the level of detail in the logs by modifying the log level in the configuration file. The common levels include:

    • DEBUG: Captures all events, including detailed debugging messages.
    • INFO: Records general operational messages.
    • WARNING: Logs potentially problematic situations that do not stop the execution.
    • ERROR: Captures errors that may halt certain operations but not the entire model.
    • CRITICAL: Logs severe errors that lead to a full stop of the model.
  3. Sample Configuration:

    log_parameters:
      showtiming: True
      log_level: DEBUG
      log_directory: logs/    

    This setup will save all logs in the logs/ directory and include detailed debug-level messages.

Benefits of Logging in T-Route:

  • Performance Analysis: By reviewing the timing information, you can assess which parts of the model take the longest to execute and target those for optimization.
  • Debugging: Detailed logs help in tracing the root cause of any issues, making it easier to identify and fix errors.
  • Model Validation: Logs provide a record of model operations, which can be useful for verifying that the model is functioning as expected, especially during development and testing phases.

Proper configuration and use of logging can greatly enhance the usability, performance, and reliability of the T-Route model.

Clone this wiki locally