opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Logs sent via client.app.log() are not visible with --print-logs

Open rqdmap opened this issue 4 days ago • 0 comments

Description

According to the official documentation at https://opencode.ai/docs/plugins/#logging, plugins should use client.app.log() for structured logging. However, logs sent via client.app.log() are not visible in the console, even when using --print-logs --log-level DEBUG flags.

Plugins

No response

OpenCode version

1.0.220

Steps to reproduce

  1. Create Test Plugin: ~/.config/opencode/plugin/test-logging.js
export const TestLoggingPlugin = async ({ client }) => {
  return {
    event: async ({ event }) => {
      if (event.type === "session.created") {
        console.log("✅ [console.log] Session created")
        
        await client.app.log({
          service: "test-logging",
          level: "info",
          message: "✅ [client.app.log] Session created",
          extra: { sessionId: event.properties?.info?.id }
        })
      }
    }
  }
}
  1. Start OpenCode: opencode serve --port 64595 --print-logs --log-level DEBUG
  2. Connect OpenCode Server opencode attach localhost:64595 and create a new session
  3. Observe Log Output. After creating a session:
✅ [console.log] Session created
INFO  2026-01-08T08:32:08 +2ms service=server status=started method=POST path=/log request
...

Screenshot and/or share link

Image

Operating System

macOs Sequoia 15.6

Terminal

Alacritty

rqdmap avatar Jan 08 '26 08:01 rqdmap