question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[object Object] in rolling logger log files

See original GitHub issue

Hello,

I am attempting to use your module to log all requests in a simple Node.js application. I have the logger set up as:

var opts = {
    logDirectory: __dirname + '/log',
    fileNamePattern: 'transactions-<DATE>.log',
    dateFormat: 'YYYY.MM.DD'
};

var log = require('simple-node-logger').createRollingFileLogger(opts);

and am logging requests with:

app.use(
    function (req, res, next) {
        log.info(req.originalUrl);
        next();
    }
);

The resulting log files contain [object Object], like 13:34:30.703 INFO [object Object] /.

Simple file logger entries do not contain [object Object]. I tested with:

var log = require('simple-node-logger').createSimpleFileLogger('project.log');

with resulting entries to be like 13:39:26.030 INFO /

Any thoughts on what object the rolling file logger is adding to the entries?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
darrylwestcommented, Dec 11, 2016

New version is now in place. Thanks for fixing this…

0reactions
jmklotzcommented, Dec 1, 2016

This issue seems to still exist today. I had to manually comment out the lines as suggested by skyeyefront.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Rolling File Appenders - Baeldung
A quick and practical guide to using rolling file appenders in popular Java logging libraries.
Read more >
Logging different levels using same object to different files
I am using rolling file appender for this task. Also I want just one logger object to do the task. Someone might suggest...
Read more >
Rollover log files automatically in an ASP.NET Core Web ...
Step 3: Writing the log to the file. For a web application, use an object of ILogger which can be retrieved from the...
Read more >
logging.handlers — Logging handlers — Python 3.11.1 ...
The StreamHandler class, located in the core logging package, sends logging output to streams such as sys.stdout, sys.stderr or any file-like object (or, ......
Read more >
RollingFileAppender (Apache Log4j Core 2.19.0 API)
Class RollingFileAppender. java.lang.Object · org.apache.logging.log4j.core.AbstractLifeCycle ... Writes the log entry rolling over the file when required.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found