-
Notifications
You must be signed in to change notification settings - Fork 3
FAQ
The most common reason is channel linking combined with backends on more than one level of the route.
If a channel links to another channel, the message is first propagated to the linked channel and then delivered to the current channel’s own backends. If both channels print to the console or file, you will see duplication.
Example:
Logme::ID chId{"test"};
auto ch = Logme::Instance->CreateChannel(chId);
ch->AddBackend(std::make_shared<Logme::ConsoleBackend>(ch));
ch->AddLink(::CH); // the default channel usually already has ConsoleBackend
LogmeI(ch, "duplicated message");How to fix it:
- attach the backend only once in the route, or
- keep both backends but use different purposes / formats deliberately, or
- suppress link propagation for one record with
Override::Add.DisableLink
Several common reasons:
If _LOGME_ACTIVE is false for the build, the macros expand to an inert branch.
For release logging, make sure your build enables the corresponding release
option/macros documented by the project.
Logging to a channel ID is valid even if the channel does not exist yet:
Logme::ID ch{"some_name"};
LogmeI(ch, "hello");But a record only becomes visible when the target channel exists and is routed to at least one backend directly or through a link.
LEVEL_INFO is the default channel level, so debug records are dropped unless
you lower the filter.
A disabled channel drops records during Channel::Display().
This is usually a feature, not a bug. If you pass an inactive ChannelPtr,
logme may skip evaluating later arguments entirely.
The usual cause is mixing the two formatting macro families.
These macros use classic % formatting:
LogmeI("value=%i", 1); // correctUsing {} placeholders here leaves them uninterpreted.
When std::format support is enabled, the fLogme... family uses {}
placeholders:
fLogmeI("value={}", 1); // correctUsing %i with fLogme... is the wrong family.
If you call a macro without a format string, it returns a stream object:
LogmeI() << "value=" << 1;No. The implementation uses mutexes, condition variables, allocation, standard formatting facilities, and file I/O. Treat logme as a normal multi-threaded logger, not as an async-signal-safe emergency logger.
This often creates duplicate output.
Valid, but invisible.
Defaults are convenient for startup, but production setups should usually set channel levels, flags, links, and backend settings explicitly.
-
Logme...->% -
fLogme...->{}
The control server is excellent for live tweaks, but backend --add ... only
creates default backend instances. Full backend parameters still belong in code
or JSON configuration.
Q: Can I use LogmeX macros directly in if/else without braces?
if (something)
LogmeI(message1);
else
LogmeI(message2);A: No. This pattern is not safe.
LogmeX macros expand into an if-like construct, which causes the else to bind to the wrong if after macro expansion (dangling-else problem).
Minimum safe pattern (brace the branch with the macro):
if (something)
{
LogmeI(message1);
}
else
LogmeI(message2);fLogmeX macros do not suffer from this issue in the same way.
logme — flexible runtime logging system
Home · Getting Started · How-To · Runbooks · Architecture · Output · Backends · Configuration
GitHub: https://github.com/efmsoft/logme
- Home
- How-To Guide
- Getting Started
- Why logme?
- Core Concepts
- Logging Macros
- Fatal Handling
- Crash Logging
- glog Compatibility
- C API
- Choosing Logging Macros
- Function tracing
- Trace Points
- Override Scopes
- Advanced Features
- Collapse Logging
- Feature Map
- Production File Logging
- Readable Logging Topology
- Live Diagnostics
- Logging Performance Investigation
- Startup, Fatal, and Crash Diagnostics
- Troubleshooting Missing or Duplicate Logs
- Application and Platform Integration
- Structured and Protected Logs
- Migration to logme
- Overview
- Console Backend
- Debugger Backend
- File Backend
- File Rotation & Retention
- Buffer Backend
- Ring Buffer Backend
- SharedFile Backend
- Callback Backend
- Windows Event Log Backend
- Custom Backends
- Runtime Control
- Configuration
- Configuration JSON
- Control Server
- Environment Control
- Control Policies
- Trace Points
- Log Source Profiling
- Message Filtering