Changing Hyperledger Fabric log levels and log format

How to set Fabric log levels per logger, change them at runtime through the operations service, choose a format for log shipping, and replace shim logging in chaincode.

On this page

How to change Hyperledger Fabric log levels without restarting the network

When a peer or orderer misbehaves, or a team needs more detail than the default output gives, logging is usually the first lever to pull. You can raise or lower verbosity for individual loggers without restarting the node, using the operations service. The log level for each logger is controlled by FABRIC_LOGGING_SPEC, which sets a default level and optional per-logger overrides at startup, and by the /logspec endpoint on the operations service, which changes those levels at runtime. Teams typically reach for this when they are troubleshooting endorsement or gossip failures, when they need a narrow debug window around one component, or when they want to reduce noise from a chatty logger that fills central storage.

The /logspec endpoint is served by the operations service on peers and orderers, alongside /healthz, /version and metrics. It is secured with mutual TLS, so the caller must present a client certificate that the node trusts for that endpoint. Before you rely on it in an incident, confirm which certificates your operators hold, that they are issued and rotated under your own CA process, and that the operations listen address is reachable from the jump host or tooling your on-call team uses. Check the exact request format and the logger names for your Fabric version in the operations service documentation, since logger names are the detail most likely to differ between releases and between peer and orderer.

Plan the change as a short, reversible procedure. Record the current level first so you can restore it, make the narrowest change that answers your question, and set a reminder to revert it, because debug output on a busy peer can add substantial log volume and cost in your log pipeline. Changes made through the endpoint are runtime changes, so a restart will reset them to whatever FABRIC_LOGGING_SPEC specifies. If you want a level to persist, set it in the node configuration and roll that change out through your normal change process. Ask your team to confirm how the operations endpoint is exposed in your environment before an incident, not during one.

Which logging option fits which situation

This table compares the three logging choices for a Fabric peer or orderer: setting FABRIC_LOGGING_SPEC at startup, changing levels at runtime through the operations service, and choosing a log format for shipping. Read each row to see scope, how long the change lasts, what access you need and where verbose output becomes a production risk. Confirm exact logger names against the Fabric version you run before you write any spec.

OptionScope and durationAccess and risk in production
FABRIC_LOGGING_SPEC at startupSets levels for the whole process or named loggers; persists for the life of the process and is reapplied on restart from the environment or configRequires control of the node's environment or deployment manifest and a restart; verbose levels written at startup stay active until the next change, so keep production specs terse
Runtime change through /logspecChanges levels on a running peer or orderer without a restart; the change is lost on restart unless the startup setting is also updatedRequires access to the operations endpoint secured with mutual TLS client certificates; limit who holds those certificates, since verbose logging can expose sensitive transaction detail and fill disks quickly
Global level versus per-logger levelA global level affects every module and is the broadest and noisiest option; per-logger levels target one component and keep the rest at a quieter defaultStart narrow with one logger at debug for a short investigation, then revert; a global debug setting across a busy node is the most common cause of log volume surprises
Log format for shippingDetermines how each line is structured for downstream collectors; a format decision is set in node configuration, not per requestRequires a restart to change; confirm the format your log pipeline parses, and test a sample line before go-live to avoid broken parsing
Chaincode logging after shim logger removalChaincode no longer gets logs from the shim NewLogger() path in v2.5 and later, so chaincode needs its own logging mechanismChaincode logs are outside the peer's logspec control; agree who owns chaincode log levels, retention and redaction with the application team

How FABRIC_LOGGING_SPEC sets levels per logger

The FABRIC_LOGGING_SPEC setting lets you choose one default level for a peer or orderer and override that level for individual loggers, so you can raise detail for the component you are investigating without flooding the output of every other component. The spec is a list of logger names and levels separated by colons, with a bare level acting as the default. A typical incident spec keeps the default at info and raises one or two named loggers to debug. Before you change anything, record the spec the node currently runs with, and confirm the logger names and syntax in the Fabric operations service documentation for your exact release, because logger names differ between the 2.5 LTS and 3.x lines and between peers and orderers.

During an incident, narrow the spec in steps rather than switching the whole node to debug. Start by naming the one component the symptom points to, such as the gossip or endorsement path on a peer, or the consenter on an orderer, and leave the default at info. If the output is still too broad, add a second override or raise only the most specific logger. Keep a short written log of each change, the time it was made and the symptom it targeted, so the evidence trail stays clear. Plan the revert at the same time you make the change. Note whether you set the spec through the environment variable at startup or through the /logspec endpoint at runtime, because a runtime change is lost on restart and a restart reads the environment value again.

Revert to the recorded spec as soon as the question is answered, and check that the level took effect by reading the current spec back from the operations service. Debug output can contain transaction identifiers, payload fragments and peer addresses, so treat the captured logs as sensitive and limit who can read them. Ask your support or platform team to confirm two things before the first incident: where the baseline spec is stored in your deployment manifests, and who is authorized to change it on a production node. Run the same procedure in a non-production network first so the steps and the revert are known before you need them under pressure.

Setting up log level changes and checks on peers and orderers

This sequence confirms the operations service is reachable, sets a startup logging spec, changes a level at runtime, and proves each change in the log output so the original spec can be restored if needed.

  1. Confirm the operations service is enabled

    The platform engineer checks that the operations service is configured on each peer and orderer, with its listen address and TLS settings present in the node's core.yaml or orderer.yaml. Confirm the operations endpoint is bound to an address your monitoring and admin hosts can reach, and that it is not exposed beyond your management network. The step is done when the node reports its version from the operations endpoint, which proves the service is running.

  2. Verify mutual TLS on the operations endpoint

    The operator tests the operations service with a client certificate that the node trusts, and then with a request that presents no client certificate. The Fabric operations service requires mutual TLS client certificates, so the first request should succeed and the second should be rejected. If the unauthenticated request succeeds, stop and correct the TLS client authentication settings before changing any log configuration. Record which certificate and CA the admin tooling uses, since rotating it later can lock out log changes.

  3. Record the current logging spec before any change

    Before touching anything, the operator reads the current spec from the /logspec endpoint with a GET request and saves the returned value in the change record along with the node name and date. This value is the rollback point. The step is complete when the saved spec matches what the node reports on a second read, which confirms the value is stable and the endpoint returns the active configuration rather than a stale copy.

  4. Set the startup logging spec

    For a change that must survive restarts, the operator sets the FABRIC_LOGGING_SPEC environment variable or the logging spec entry in the node configuration, using per-logger entries such as a level for the peer gossip or orderer consensus module. The operator then restarts the node in a maintenance window. The step is done when the node starts and the spec read from /logspec matches the value written into configuration.

  5. Change a level at runtime through /logspec

    For a temporary change, the operator sends a PUT request to /logspec over the mutually authenticated connection with a new spec that changes one logger, leaving the rest unchanged. Runtime changes do not persist across restarts, so the change should be scoped to the investigation. The step is done when the PUT returns success and a follow-up GET shows the new spec in effect.

  6. Confirm the change appears in log output

    The operator triggers the activity that the changed logger covers, such as a transaction submission for a peer logger or a channel operation for an orderer, and then searches the node's log output for lines from that logger at the new level. Seeing the expected lines confirms the change worked, and the absence of lines at a more detailed level confirms the spec did not apply where it was not meant to. If no lines appear, check the logger name for typos before assuming the endpoint failed.

  7. Restore the original spec and record the result

    Once the investigation is finished, the operator sends a PUT to /logspec with the spec saved in the first step, then reads it back and checks that the output level has returned to its previous setting. The operator records the start time, the spec changed, the verification log lines and the restored spec in the change record. The step is complete when the restored spec matches the saved value and the change record is filed with the node's configuration history.

Choosing a log format for shipping to a central system

The log format decision for Fabric peers and orderers determines how cleanly a central platform can parse, index and alert on them, so it should be settled with the team that owns the log pipeline before any node is changed. Graylog, OpenSearch and Loki each ingest text through different parsers, extractors and label schemes. A format that a peer emits as a single readable line may need custom grok rules or Loki pipeline stages to pull out the logger name, level and timestamp, and every rule is something your pipeline team will maintain after go-live. Ask them which fields they need as searchable attributes, which they can store as free text, and whether they prefer one line per event with consistent key names. Write those answers down as the logging contract for the network.

Before you ship anything, confirm the exact output behavior of the Fabric release you run. Log line layout, timestamp precision, and whether the logger name and module appear as separate tokens can differ between the 2.5 LTS line and the 3.x line, and between patch releases. Check the FABRIC_LOGGING_SPEC documentation for your version, then run a peer and an orderer in a test environment, capture a few hundred lines of each under normal and error conditions, and feed them through the real ingestion pipeline. Confirm that a multi-line stack trace or a panic stays together as one event. Record the version, the sample lines and the parser that matched them, so that an upgrade later has a baseline to compare against.

Consistency across organizations matters because each member runs its own peers and orderers, often with different log collectors, and an investigation during an incident may need to correlate events across all of them. Agree on a shared field vocabulary in the network governance documents: the names used for the node, organization, channel and logger, the timestamp format and time zone, and the level names. Have every member's log pipeline map its local output onto that vocabulary, and test the mapping with the same sample set on each side. Keep the mapping under change control, because a silent change in one organization's collector will break cross-organization searches without anyone noticing. Where a member cannot match the agreed vocabulary, document the gap so that the operator reading the logs knows which fields to treat with caution.

How chaincode logging changed after the shim logger removal

Support for chaincode that uses the shim logger through NewLogger() was removed, so chaincode now has to bring its own logging. The cards below cover the practical work this creates: finding affected code, choosing a replacement, reading the output, setting levels and testing before an upgrade.

Find chaincode that calls NewLogger

Search every chaincode package your channels use for calls to NewLogger() from the shim package, including vendored copies and chaincode you received from other members. Record the chaincode name, the version currently committed on each channel, and the owning team. This inventory sets the scope of the work, because a chaincode definition can still be running code that calls the removed function until its package is replaced and redefined.

Fabric v2.5 upgrade notes

Choose a replacement logger

Chaincode must now use its own logging mechanism, so each chaincode team needs to pick a logger that fits its language and build. Confirm that the logger writes to standard output or standard error, since that is where operators will look, and check that it does not write sensitive ledger data or private values into logs. Document the choice in the chaincode repository so the next developer does not reintroduce the removed call.

Removal documented in
v2.5

Locate chaincode output

Chaincode output is not part of the peer's own log stream in the same way peer messages are. Confirm with your chaincode deployment model, whether chaincode runs as a peer-launched container or as an external service, where its output is collected. Then add that location to your log shipping configuration so chaincode messages reach the same search tools as peer and orderer logs.

Set chaincode levels separately

Changing the peer's FABRIC_LOGGING_SPEC or the operations service log level does not automatically change the level chaincode writes at. Agree on a chaincode level policy with each application team, for example which levels are kept in production and which are used only during investigations. Verify the setting on a test peer first, because verbose chaincode logs can expose transaction inputs and grow storage quickly.

Test before upgrading

Before moving a peer to a Fabric release where the shim logger is gone, install and invoke every affected chaincode on a test network built from the same versions. Check that the new logger initializes, that expected messages appear where your collector reads them, and that transactions still endorse and commit. Keep the test results with the change record, since they show what was verified before production.

Upgrade guide

Questions teams ask before changing Fabric logging

Can our own team change Fabric log levels without outside help?

Yes, for a small network with one or two people who already run peers and orderers. Changing levels is a configuration task: you set FABRIC_LOGGING_SPEC in the peer or orderer environment, or call the /logspec endpoint of the operations service to change levels at runtime. The harder part is deciding which loggers to raise, confirming that the change does not flood the log pipeline, and proving the result to your security and operations owners. Teams that lack an operations service that is already reachable, or that have no staff who can issue mutual TLS client certificates for it, usually need help with access before they can start.

What drives the effort of a Fabric logging change?

The main drivers are the number of peers and orderers, the number of logging pipelines that receive their output, and the number of chaincodes whose logs you need to read. Each peer and orderer has its own operations endpoint, so a change across ten nodes is ten configuration changes plus ten checks. A log pipeline with several consumers, such as a SIEM and an operations dashboard, adds format and field mapping work for each consumer. Chaincode count matters because each chaincode needs a logging approach of its own. Ask any partner to break the quote down by node count, pipeline count and chaincode count so you can see which driver moves the price.

How long does it take to verify a logging change?

Verification takes as long as it takes to generate representative traffic at the new level and confirm the output reaches the log platform in the expected format. The duration depends on how many nodes you change, how often your channels transact, and how long your log platform takes to index new fields. Plan for a test in a non-production network first, then a staged rollout one node at a time, checking each node's output before moving on. No fixed duration applies to every network, so ask your team or a partner to size the verification window against your own transaction volume and change approval process.

What does the work need from our team?

The work needs three groups of people. Platform engineers need access to the operations service on each peer and orderer, which requires client certificates that the operations service accepts under its mutual TLS setup. Security or PKI staff need to confirm which certificates are valid and who may issue them, because changing log settings is an administrative action. Log platform owners need to agree on the format, field names and retention they will accept before any output is shipped. Name these owners before the change starts, since a delay in any one group pauses the whole change.

Does changing a Fabric log level require a restart?

Runtime changes do not require a restart when you use the operations service /logspec endpoint, which lets you read and set the logging specification while the node runs. Changing FABRIC_LOGGING_SPEC in the environment is a startup setting, so it takes effect when the node restarts. Confirm this behavior against the version you run, because the operations service documentation describes the endpoint and the environment variable separately. Plan any restart on a rolling basis so ordering and endorsement stay available, and record which setting each node uses after the change so that a later restart does not silently revert it.

How does chaincode logging affect our upgrade plan?

Chaincodes that used the shim logger through NewLogger() need a change before upgrading to Fabric v2.5. Support for that shim logger was removed, so each chaincode must use its own logging mechanism. Treat this as an application change: list every chaincode, identify those that call the removed logger, choose a replacement, and test the chaincode in a non-production network before the network upgrade starts. Keep the chaincode logging change separate from the peer log level change so that a failure in one does not hide the cause of the other.

Which log format should we choose for shipping logs?

Choose the format your log platform parses without custom work, then confirm that the Fabric output carries the fields your investigations need, such as the logger name, level, peer or orderer identity and channel. The supplied sources do not list the available format options in detail, so confirm the exact format settings against the Fabric logging documentation for your release. Decide the format with the log platform owners before changing any node, because switching formats later reindexes history and can break existing alerts.

How log level requests reach peers and orderers

The request starts with an operator's client presenting a certificate to the operations service on a peer or orderer, which is the mutual TLS trust boundary. The operations service applies the logging spec through /logspec, and the node keeps writing its own logs to standard output. A shipping agent collects that output and forwards it to a central log platform. Chaincode logs take a separate path through the chaincode container, so check both paths when you change levels.

Log level requests and log output paths for Fabric peers, orderers and chaincode.

How DeployOpen scopes and delivers Fabric logging work

DeployOpen treats Fabric logging as a change to a running network, not a config tweak. We agree the loggers, levels and log destination in writing, apply the change to peers and orderers in a controlled order, and document how your team can adjust levels again later. The work is delivered inside your own infrastructure and tested before it reaches production.

How we scope

  • Inventory every peer, orderer and chaincode container whose logs will change, with its current FABRIC_LOGGING_SPEC value
  • Agree the target logger levels, the log format for your shipper, and which components stay at default verbosity
  • Confirm who can call the operations service /logspec endpoint and how mutual TLS client certificates are issued and stored
  • Fix the written scope, deliverables and timeline before work starts, since most engagements are fixed-scope

How we build

  • Set FABRIC_LOGGING_SPEC per logger in the peer and orderer configuration and test each change on a non-production network first
  • Verify runtime level changes through the operations service and confirm they revert cleanly after a restart
  • Check that chaincode logging uses the chaincode's own logging mechanism, since the shim logger is no longer supported
  • Test the chosen log format end to end through your log shipper so fields parse correctly before go-live

How we hand over

  • Deliver a reference of logger names, approved levels and the change procedure for each node type
  • Document the runbook for changing levels at runtime, including who approves changes and how changes are recorded
  • Provide test evidence from the staging run showing parsed log output and confirmed level changes
  • Walk your operators through the runbook and the rollback steps so they can repeat the work without us

How we support

  • Review logging changes alongside Fabric version upgrades, since the logging setup should be checked after each binary update
  • Offer ongoing support and upgrades as a retainer if your team wants DeployOpen to keep the configuration current
  • Re-run tests when log shippers, dashboards or chaincode images change, and document any new fields
  • Ask for a quote that lists scope, deliverables and any retainer terms in writing before engagement begins

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.