Λογότυπο Method Trace Log

Method Trace Log

Κοινότητα
wb04307201

Non-intrusive AOP method tracing + trace tree + alerting for Spring Boot. Includes a standalone MCP server (`methodTraceLog-mcp`) that exposes the same capabilities to AI agents over stdio.

Εκδότηςwb04307201
ΑποθετήριοmethodTraceLog
ΓλώσσαJava
Forks
1
Αστέρια
47
Διαθέσιμα εργαλεία
0
Τύπος μεταφοράςstdio
Κατηγορίες
Άδεια χρήσηςApache-2.0
Σύνδεσμοι
  • Συνδέστε εργαλεία σε ροές εργασίας AI

    Το Method Trace Log παρέχει δυνατότητες MCP που μπορούν να χρησιμοποιηθούν από συμβατές εφαρμογές-πελάτες AI και πράκτορες AI.

  • 0 διαθέσιμα εργαλεία

    Περιηγηθείτε παρακάτω στις ενέργειες που μπορούν να κληθούν, μαζί με τα ονόματα και τις περιγραφές τους, όταν παρέχονται από τον διακομιστή.

  • Ρυθμίσεις έτοιμες για αντιγραφή

    Χρησιμοποιήστε τα αποσπάσματα εγκατάστασης για να ρυθμίσετε αυτόν τον διακομιστή στην εφαρμογή-πελάτη MCP που προτιμάτε.

  • Δείκτες ενδιαφέροντος για τον ανοιχτό κώδικα

    47 αστέρια και 1 διακλαδώσεις στο συνδεδεμένο αποθετήριο.

Method Trace Log

Non-intrusive AOP method tracing + trace tree + alerting for Spring Boot. Includes a standalone MCP server (methodTraceLog-mcp) that exposes the same capabilities to AI agents over stdio.

star fork star fork MIT JDK SpringBoot

gif.gif


Features

Method tracingAOP-based, full call chain with traceid / spanid / pspanid; sampling; @AspectLog to override the display name
MetricsMicrometer Timer per method + parent/child MethodTraceInfo tree; exposed via actuator/methodtrace
Log file viewerRead / filter / download log files; WebSocket live tail; path-traversal safe
CFR decompileHTTP endpoint for any class on the classpath (app / 3rd-party / fat-jar nested), annotations stripped
OTel exportAuto-bridges trace events to OpenTelemetry OTLP/HTTP when opentelemetry-sdk is on the classpath
W3C traceparentAuto-injects / extracts traceparent header for HTTP inbound and RestClient outbound
Cookie sessionBrowser login via POST /methodTraceLog/login, HTTP X-Api-Key for CLI / MCP
MCP serverStandalone stdio process; 15 tools, multi-host, forwards to your starter over HTTP

Quick Start

Add the dependency

xml
<dependency>
    <groupId>io.github.wb04307201</groupId>
    <artifactId>methodTraceLog-spring-boot-starter</artifactId>
    <version>1.1.0</version>
</dependency>

Minimal configuration

yaml
method-trace-log:
  log:
    enable: true
  file:
    enable: true
    path: ./logs
  security:
    api-key: change-me-in-production   # required in production; empty disables auth (dev only)

management:
  endpoints:
    web:
      exposure:
        include: methodtrace           # for the /actuator/methodtrace panel data

Open the panel

http://localhost:8080/methodTraceLog/panel — single page with 4 tabs: 概览 (overview) / 调用记录 (trace search + export) / 日志文件 (file viewer + real-time tail) / 反编译 (CFR decompile).


Configuration Reference

yaml
method-trace-log:
  log:
    enable: true                                  # AOP master switch
    sample-rate: 1.0                              # 0.0 ~ 1.0; child spans inherit parent decision (clamped on startup)
    exclude-patterns: []                          # method-name blacklist (case-insensitive equals match); hit → proceed() directly, no events emitted. e.g. [equals, hashCode, toString, canEqual]
    service-calls:                                # start-up enable flags
      - { name: CustomLog,         enable: false }   # built-in services: SimpleLogService / SimpleMonitorService / AlertingService / CustomLog
    trace-store:                                  # where the in-memory tree lives
      type: in-memory                             # in-memory | file | none
      path: ./trace-store                         # only when type=file (auto-creates yyyy-MM-dd subdirs)
      max-traces: 1000                            # recent map cap (in-memory & file memory cache)
      ttl-millis: 28800000                        # 8h; clean() drops disk files older than this
      rebuild-index-on-start: false               # type=file only; rebuilds traceId→file index at startup (slows boot on large dirs)
  file:
    enable: true
    path: ./logs
    allowed-extensions: [.log, .txt, .out]
    scan-lines: 10000                             # stream-scan line cap; Files.lines() + limit() is lazy, so the file itself can be arbitrarily large — no size check
    max-file-size: 100MB                          # per-file size cap (default; set to 0/null = no limit)
    total-size-cap: 10GB                          # cumulative cap across all rolled files in the dir
    # log-pattern: (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\s+\[([^\]]+)\]\s+(\w+)\s+([^\s]+)\s*-\s*(.*)
  security:
    api-key: change-me-in-production              # empty = no auth
    session:
      ttl-millis: 28800000                        # 8h sliding session for browser cookies
    cors:                                         # CORS for browser panels on different origins (opt-in: empty allowed-origins = disabled)
      allowed-origins: []                         # ["https://your-panel.example.com"]; ["*"] = all (incompatible with credentials)
      allowed-methods: [GET, POST, OPTIONS, DELETE, PUT]
      allowed-headers: [Content-Type, X-Api-Key, Authorization]
      allow-credentials: false                    # true requires allowed-origins NOT be "*"
      max-age: 0                                  # preflight cache seconds (0 = always re-validate)
  decompile:
    timeout-seconds: 10                           # CFR daemon-thread timeout
  otel:                                           # requires opentelemetry-sdk on classpath
    enable: false
    endpoint: http://localhost:4318/v1/traces
    service-name: method-trace-log
    service-namespace: ""                        # Resource service.namespace label
    export-delay-millis: 5000                    # OTLP client built-in batching delay
    max-queue-size: 2048
    max-export-batch-size: 512
    export-timeout-millis: 30000
  propagate:                                      # W3C traceparent propagation
    http-inbound: true                            # TraceContextFilter reads traceparent
    rest-client-outbound: true                    # RestClient.Builder interceptor
    rest-template-interceptor: true               # exposes a RestTemplate interceptor bean
  alerting:                                       # exception alerting — opt-in; off by default
    enable: false                                 # true registers AlertingService as an ICallService
    webhook-url: ""                               # empty = log only; non-empty POSTs events (best-effort, async)
    threshold:
      error-count: 10                             # errors per class#method within window to fire
      window-seconds: 60                          # sliding-window length
    cooldown-seconds: 300                         # suppress repeat alerts for the same key
    classes: []                                   # whitelist prefix list; empty = alert on every class

HTTP Surface

All routes require X-Api-Key (or MTRACE_SESSION cookie) when security.api-key is non-empty, except /methodTraceLog/panel (HTML).

MethodPathPurpose
GET/methodTraceLog/panelHTML panel — 4 tabs (whitelisted)
GET/methodTraceLog/view/callServicesList services + enable state
GET/methodTraceLog/view/callService?name=&enable=Toggle a service at runtime
GET/methodTraceLog/view/list?className=&methodName=&onlyErrors=&limit=Recent root traces
GET/methodTraceLog/view/traceid?id=Full call chain for a trace id
GET/methodTraceLog/view/export?format=json|csv&className=&methodName=&onlyErrors=&limit=Bulk export (default limit 1000)
GET/methodTraceLog/view/alerts?limit=Recent alert events (default limit 50; empty list when alerting disabled)
GET/methodTraceLog/view/slowMethods?windowMinutes=&topN=Slowest methods top-N from Micrometer histograms (default 5min / top 10)
GET/methodTraceLog/decompile?className=&methodName=&timeoutSeconds=Text/plain source
GET/methodTraceLog/logFile/filesList log files in the configured dir
POST/methodTraceLog/logFile/queryFilter / paginate / time-range / level
POST/methodTraceLog/logFile/downloadStream the same content as text
GET/methodTraceLog/logFile/monitor/{start,stop,status}?fileName=REST live-tail (companion to STOMP)
POST/methodTraceLog/loginBody {"apiKey":"..."} → Set-Cookie: MTRACE_SESSION=...
POST/methodTraceLog/logoutInvalidate session
GET/methodTraceLog/session/status{ sessionValid: true/false }
WS/ws (SockJS) → /topic/log-monitorLive log lines; STOMP send to /app/{start-monitor,stop-monitor,monitor-status,heartbeat}
GET/actuator/methodtracePer-class / per-method Micrometer stats

MDC Trace IDs

LogAspect puts traceid / spanid / pspanid into SLF4J MDC. Use them in your logback pattern to correlate logs across the call chain:

xml
<pattern>%d{HH:mm:ss.SSS} [%thread] [trace=%X{traceid} span=%X{spanid}] %-5level %logger - %msg%n</pattern>

For HTTP boundaries, TraceContextFilter reads traceparent on the way in, and the RestClient interceptor writes it on the way out — upstream and downstream traceids join automatically.


Web Panel Authentication

When security.api-key is non-empty, the panel UI uses a top banner (not a modal) to collect the API Key:

  • Banner is shown above the tab content the first time you visit /methodTraceLog/panel without a valid session.
  • Submitting a valid Key (button or Enter) hides the banner, sets the MTRACE_SESSION cookie, and auto-loads the current tab's data — no manual refresh.
  • Wrong / empty Key shows an inline error (请输入 API Key / ❌ API Key 无效或鉴权未启用).
  • Session is a sliding 8-hour cookie (security.session.ttl-millis, default 28 800 000). It renews on use, so you only re-enter the Key after 8h of inactivity or after clicking the 🚪 注销 button.
  • The logout button only appears in the header when a session is active; the /methodTraceLog/logout endpoint invalidates the cookie and re-mounts the banner.
  • In dev mode (api-key: ""), the banner is suppressed entirely and no logout button is shown.

GET /methodTraceLog/session/status returns { authEnabled, sessionValid } so the panel JS can decide whether to show the banner. While the banner is up, the in-page mtlFetch queues 401 responses and replays them on successful login, so the user never sees an "unauthorized" toast during the login flow.

CLI / MCP clients should keep using the X-Api-Key header directly — the cookie session is purely a browser convenience.


@AspectLog Annotation

Method-level opt-in (the class doesn't have to be a @Component). Use it to rename the method in the trace tree and on the OTel span:

java
public class MyHelper {
    @AspectLog("do-something")
    public void doSomething(String s) { ... }
}

The trace list and OTel span name will show do-something instead of the raw method signature.


Custom ICallService

Extend AbstractCallService and implement consumer(ServiceCallInfo). It's auto-picked up by the CallServiceStrategy:

java
@Component
public class MyService extends AbstractCallService {

    @Override
    public void consumer(ServiceCallInfo info) {
        // logActionEnum is one of BEFORE / AFTER_RETURN / AFTER_THROW
        log.info("{} {}", info.getClassName(), info.getMethodName());
    }

    @Override public String getCallServiceName() { return "MyService"; }
    @Override public String getCallServiceDesc() { return "My desc"; }
}

Start it disabled: service-calls: [{ name: MyService, enable: false }], then flip via the panel.


MCP Server

A separate, standalone Spring Boot process that speaks Model Context Protocol over stdio. It forwards @Tool calls to one or more hosts (each host = an app that has the starter on the classpath) over HTTP.

MCP server config (mcpServers JSON block) for AI clients like Claude Desktop, Cursor, Cline:

json
{
  "mcpServers": {
    "sql-forge-mcp": {
      "command": "jbang.cmd",
      "args": [
        "io.github.wb04307201:methodTraceLog-mcp:1.1.0",
        "--method-trace-log.mcp.hosts[0].name=local-dev",
        "--method-trace-log.mcp.hosts[0].url=http://localhost:8080",
        "--method-trace-log.mcp.hosts[0].description=Local dev",
        "--method-trace-log.mcp.hosts[0].api-key=change-me-in-production"
      ]
    }
  }
}

15 tools exposed: getHosts, ping, getCallServices, setCallServiceEnable, getMethodTraceList, getMethodTraceByTraceId, getAlerts, getSlowMethods, decompileMethod, getLogFiles, queryLogContent, downloadLog, startMonitor, stopMonitor, getMonitorStatus.


Gotchas

  • LogAspect exclusions: framework-internal types (ICallService, MethodTraceLogEndPoint, LogFileService, LogFileRealTimeService) are excluded. Add yours to the pointcut if you have similar internal beans.
  • Path traversal: FileUtils.pathInspection is the whitelist for LogFileService and LogFileRealTimeService — [a-zA-Z0-9._-]+, no .., ≤ 255 chars.
  • Log pattern: the default log-pattern only matches the standard logback pattern. If you change <pattern> in logback.xml, update log-pattern in YAML or LogLineInfo.parse will not split keyword / level / time.
  • CFR resources: decompile reads class bytes through the classloader's getResourceAsStream — works uniformly for file paths, thin jars, and Spring Boot fat-jar nested jars. Don't parse the URL.getPath() string.
  • Spring Boot fat-jar: the test module does not declare spring-boot-maven-plugin. Use mvn package then java -cp target/classes;<classpath> cn.wubo.method.trace.log.MethodTraceLogTestApplication.
  • Maven on this machine: invoke mvn as /c/developer/apache-maven-3.9.16/bin/mvn — the default mvn shim is broken.

Εγκατάσταση

TypingMind
{
  "mcpServers": {
    "methodtracelog": {
      "command": "java",
      "args": [
        "-jar",
        "path/to/your/methodTraceLog-mcp.jar"
      ]
    }
  }
}

Χρησιμοποιήστε το MCP Method Trace Log με πολλά μοντέλα AI

Το TypingMind συνδέει τα εργαλεία MCP σε επίπεδο χώρου εργασίας. Έτσι, μόλις συνδεθεί το Method Trace Log, μπορείτε να το χρησιμοποιείτε με διαφορετικά μοντέλα AI στο TypingMind, αντί να το ρυθμίζετε ξεχωριστά για κάθε μοντέλο. Αυτή η ενσωμάτωση MCP εκτελείται τοπικά στη συσκευή σας μέσω του συνδέσμου MCP του TypingMind.

Οδηγός ρύθμισης για τη χρήση του τοπικού συνδέσμου

Επιλέξτε αυτή τη μέθοδο όταν ο διακομιστής MCP χρειάζεται πρόσβαση σε τοπικά αρχεία, εφαρμογές ή ιδιωτικούς πόρους στον υπολογιστή σας.

1

Ανοίξτε τις ρυθμίσεις MCP

Στο TypingMind, μεταβείτε στις «Ρυθμίσεις», έπειτα στις «Σύνθετες ρυθμίσεις» και στο «Model Context Protocol» και επιλέξτε «Ρύθμιση συνδέσμου».

  1. Ανοίξτε το TypingMind στο πρόγραμμα περιήγησής σας.
  2. Κάντε κλικ στο εικονίδιο «Ρυθμίσεις».
  3. Μεταβείτε στις «Σύνθετες ρυθμίσεις».
  4. Ανοίξτε την ενότητα Model Context Protocol.
  5. Κάντε κλικ στην επιλογή «Ρύθμιση συνδέσμου» και επιλέξτε «Αυτή η συσκευή».
Οθόνη ρύθμισης συνδέσμου MCP του TypingMind με επιλεγμένη την επιλογή «Αυτή η συσκευή»
2

Εκτελέστε την εντολή του συνδέσμου

Επιλέξτε «Αυτή η συσκευή», αντιγράψτε την εντολή από το TypingMind και εκτελέστε την στο Τερματικό. Διατηρήστε τη διεργασία σε λειτουργία όσο χρησιμοποιείτε το MCP.

  1. Αντιγράψτε την εντολή ρύθμισης που εμφανίζεται στο TypingMind.
  2. Ανοίξτε το Τερματικό στο macOS ή το Windows Terminal στα Windows.
  3. Επικολλήστε και εκτελέστε την εντολή.
  4. Εγκρίνετε την εγκατάσταση του πακέτου, αν το Τερματικό σάς ζητήσει επιβεβαίωση για να συνεχίσει.
  5. Διατηρήστε ανοιχτό το παράθυρο του Τερματικού και τη διεργασία σε λειτουργία όσο χρησιμοποιείτε εργαλεία MCP.
3

Προσθέστε το Method Trace Log ως διακομιστή

Όταν η κατάσταση του συνδέσμου είναι «Έτοιμος», κάντε κλικ στο «Αλλαγή servers» και επικολλήστε τις ρυθμίσεις του διακομιστή MCP.

  1. Περιμένετε μέχρι η κατάσταση του συνδέσμου να εμφανιστεί ως «Έτοιμος».
  2. Κάντε κλικ στο «Αλλαγή servers».
  3. Επικολλήστε τις ρυθμίσεις του διακομιστή MCP Method Trace Log.
  4. Αποθηκεύστε τη λίστα διακομιστών.
  5. Κάντε ανανέωση αν θέλετε να επιβεβαιώσετε ότι ο σύνδεσμος παραμένει έτοιμος για χρήση.
Ρυθμίσεις MCP του TypingMind με ενεργό διακομιστή και το κουμπί «Αλλαγή servers»
{
  "mcpServers": {
    "methodtracelog": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Χρησιμοποιήστε τη σύνδεση με διαφορετικά μοντέλα

Αποθηκεύστε τη λίστα διακομιστών, ανοίξτε τα «Πρόσθετα», ενεργοποιήστε τα εργαλεία MCP του Method Trace Log και έπειτα επιλέξτε οποιοδήποτε υποστηριζόμενο μοντέλο AI στο TypingMind. Χρησιμοποιήστε τα εργαλεία στη συνομιλία ή αναθέστε τα σε έναν πράκτορα AI.

  1. Ανοίξτε τη σελίδα «Πρόσθετα» στο TypingMind.
  2. Ενεργοποιήστε τα εργαλεία MCP του Method Trace Log.
  3. Ξεκινήστε μια συνομιλία και επιλέξτε το μοντέλο AI που θέλετε να χρησιμοποιήσετε.
  4. Χρησιμοποιήστε τα εργαλεία MCP στη συνομιλία ή αντιστοιχίστε τα σε έναν πράκτορα AI.
  5. Μεταβείτε σε άλλο μοντέλο AI όποτε χρειάζεται, χωρίς να συνδέσετε ξανά το MCP.
Συνομιλία στο TypingMind με ενεργοποιημένα εργαλεία MCP και επιλεγμένο μοντέλο AI
Θα με βοηθήσετε σε αυτό μέσω Method Trace Log;
Method Trace Log
Βεβαίως. Το διάβασα.
Δείτε τι βρήκα μέσω του Method Trace Log.

Συχνές ερωτήσεις

Σε τι χρησιμεύει ο διακομιστής MCP Method Trace Log;

Το Method Trace Log είναι ένας διακομιστής MCP που επιτρέπει σε συμβατές εφαρμογές AI να συνδέονται με εξωτερικά εργαλεία και πληροφορίες πλαισίου. Στο TypingMind, μπορείτε να προσθέσετε αυτόν τον διακομιστή MCP μία φορά και να κάνετε τα εργαλεία του διαθέσιμα στον χώρο εργασίας AI σας.

Μπορώ να χρησιμοποιήσω το Method Trace Log MCP με πολλά μοντέλα AI στο TypingMind;

Ναι. Το TypingMind συνδέει τα εργαλεία MCP σε επίπεδο χώρου εργασίας, ώστε να μπορείτε να χρησιμοποιείτε το Method Trace Log με διαφορετικά μοντέλα AI, όπως τα Claude, ChatGPT, Gemini ή άλλα μοντέλα που έχετε ρυθμίσει στο TypingMind, χωρίς να ρυθμίζετε τον διακομιστή MCP ξεχωριστά για κάθε μοντέλο.

Γιατί να χρησιμοποιήσετε τον σύνδεσμο MCP Method Trace Log με το TypingMind;

Το TypingMind είναι ένα από τα καλύτερα περιβάλλοντα συνομιλίας με μεγάλα γλωσσικά μοντέλα, καθώς συγκεντρώνει πολλά μοντέλα AI, προτροπές, πρόσθετα, πράκτορες AI, κλειδιά API και εργαλεία MCP σε έναν χώρο εργασίας. Συνδέοντας το Method Trace Log, μπορείτε να χρησιμοποιείτε τα εργαλεία MCP του με τα μοντέλα που προτιμάτε, διατηρώντας οργανωμένη τη ροή εργασίας των συνομιλιών σας στο TypingMind.

Πώς συνδέω το Method Trace Log MCP στο TypingMind;

Το Method Trace Log λειτουργεί μέσω του τοπικού συνδέσμου MCP του TypingMind. Αυτή είναι η καλύτερη επιλογή όταν ο διακομιστής MCP χρειάζεται πρόσβαση σε τοπικά αρχεία, εφαρμογές υπολογιστή, εργαλεία γραμμής εντολών ή ιδιωτικούς πόρους στον υπολογιστή σας.

Ποια εργαλεία παρέχει το Method Trace Log MCP στο TypingMind;

Το Method Trace Log διαθέτει δυνατότητες MCP που μπορείτε να ενεργοποιήσετε από τη σελίδα Πρόσθετα του TypingMind και να χρησιμοποιήσετε σε συνομιλίες ή να αναθέσετε σε πράκτορες AI.

Χρειάζεται να κοινοποιήσω τα κλειδιά API μου στο TypingMind για να χρησιμοποιήσω το Method Trace Log MCP;

Όχι. Το TypingMind δίνει προτεραιότητα στην τοπική λειτουργία και σας επιτρέπει να διατηρείτε τον έλεγχο των παρόχων μοντέλων, των κλειδιών API, των προτροπών και των ρυθμίσεων MCP σας. Αν το Method Trace Log απαιτεί έλεγχο ταυτότητας, προσθέστε τις απαιτούμενες κεφαλίδες, τις ρυθμίσεις OAuth ή τις τοπικές ρυθμίσεις για τον συγκεκριμένο διακομιστή MCP κατά τη δημιουργία της σύνδεσης.

Σχετικοί διακομιστές MCP

Προβολή όλων

Στήστε δικό σας χώρο εργασίας AI τώρα

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇