/

Monitor Logging

Configure how Monitor logs security events, threat detections, and operational information. Multiple output destinations, configurable log levels, and cloud reporting for centralized forensic logging.


Overview

Monitor generates log events for every security-relevant action: protection module initialization, threat detections, response actions taken, cloud sync status, and internal errors. You control what gets logged, at what level, and where the output goes.

Logging can be configured from three sources:

  • Cloud Dashboard: Toggle logging settings in the Advanced Configuration panel of the Workflow tab
  • JSON file: Define logging fields in your configuration file
  • Configuration API: Set logging options programmatically in code

Log Levels

Monitor supports four log levels, from most to least verbose:

LevelEnum ValueDescriptionWhen to Use
DebugBHMLogLevelDebugDetailed diagnostic information including internal stateDevelopment and active troubleshooting only
InfoBHMLogLevelInfoGeneral operational events: module loaded, config synced, incident reportedDefault for production
WarningBHMLogLevelWarningPotential issues that do not prevent operationStaging environments, early detection of misconfigurations
ErrorBHMLogLevelErrorErrors that affect functionality but do not stop MonitorProduction minimum recommended level

Set the minimum level to control which events are recorded. For example, setting the level to Warning records Warning and Error events, but ignores Debug and Info.


Configuration

JSON Configuration

JSON
{
  "apiToken": "${BYTEHIDE_TOKEN}",
  "logLevel": "info",
  "enableConsoleLogs": true,
  "enableFileLogs": false
}
FieldTypeDefaultDescription
logLevelstring"info""debug", "info", "warning", "error"
enableConsoleLogsbooleantrueEnable console logging (NSLog / os_log output)
enableFileLogsbooleanfalseEnable file logging to disk

Code-Based Configuration (Swift)

Swift
import ByteHideMonitor

BHMMonitor.configure { config in
    config.logLevel(.info)

    // Protections...
    config.enableAllProtections(.log, intervalMs: 5000)
}

Code-Based Configuration (Objective-C)

OBJC
#import <ByteHideMonitor/ByteHideMonitor.h>

[BHMMonitor configure:^(BHMMonitorConfiguration *config) {
    [config logLevel:BHMLogLevelInfo];

    // Protections...
    [config enableAllProtections:BHMActionTypeLog intervalMs:5000];
}];

Output Destinations

Console Output

Outputs Monitor events to the system console via NSLog / os_log. Useful during development in Xcode and visible in the Console app.

Console logging is enabled by default. To disable it in JSON:

JSON
{
  "enableConsoleLogs": false
}

File Logging

Writes Monitor events to a log file on disk. The file path can be configured via the logFilePath property in code.

JSON
{
  "enableFileLogs": true
}

Cloud Dashboard Configuration

You can configure logging settings from the Advanced Configuration panel in the Workflow tab of the Cloud Dashboard:

SettingDescription
LoggingMaster toggle to enable or disable all logging
Minimum LevelSelect the minimum log level (Debug, Info, Warning, Error)
Console OutputToggle stdout output
Debug LoggingToggle verbose diagnostic output (not for production)

Changes made in the Cloud Dashboard apply immediately to all running instances without redeployment.


Log Output Format

Monitor log entries include:

  • Timestamp: When the event occurred
  • Level: Log level (Debug, Info, Warning, Error)
  • Module: Which protection module generated the event
  • Message: Description of the event
  • Threat Details: For detection events, includes threat type, confidence score, and action taken

Example console output:

CODE
[2025-01-15 10:23:45.123] [INFO]  Monitor initialized successfully
[2025-01-15 10:23:45.456] [INFO]  Protection modules loaded: 6 active
[2025-01-15 10:24:12.789] [WARN]  JailbreakDetection detected - Action: CLOSE - Confidence: 0.95
[2025-01-15 10:24:12.790] [INFO]  Incident reported to ByteHide Cloud

Best Practices

  • Set the minimum level to Info in production for a balance between visibility and log volume
  • Enable console logging during development for real-time Xcode output
  • Enable file logging for on-premise or offline deployments where cloud logging is not available
  • Keep debug logging disabled in production. Enable it temporarily when troubleshooting, then disable it again
  • Review Cloud Panel incidents regularly to identify threat patterns and false positives

Next Steps

Cloud Configuration

Configure logging from the Cloud Dashboard

JSON Configuration

Full JSON schema reference including logging options

Troubleshooting

Common issues and debugging steps

Previous
Configuration API