Skip to content

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

@rqdmap

Description

@rqdmap

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions