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.

Doing a test at 2017-09-08 00:06:15, but the time is outputting an hour behind (UTC?). Problem is moment.js isn’t an hour behind (in the same file).

So when it goes to check for the log file, it sees that the today’s log is empty - which is technically right, but both times should line up.

Example messaged placed in yesterday’s file: [2017-09-07 23:06:15.038] [WARN] message example.

The transport code:

var transport = new winstonMain.transports.DailyRotateFile({
	filename: './log',
	datePattern: 'yyyy-MM-dd.',
	prepend: true,
	level: process.env.NODE_ENV === 'development' ? 'debug' : 'info'
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
gitramrocommented, Oct 3, 2017

im having trouble with local time also, im giving localTime value true but im still getting utc on my log file


const winston = require('winston');
const winstonRotator = require('winston-daily-rotate-file');

const consoleConfig = [
 new winston.transports.Console({
   'colorize': true
 })
];

const createLogger = new winston.Logger({
 'transports': consoleConfig
});

const successLogger = createLogger;
successLogger.add(winstonRotator, {
 'name': 'access-file',
 'level': 'info',
 'filename': './log/info.log',
 'localTime': true,
 'json': false,
 'datePattern': 'yyyy-MM-dd-',
 'prepend': true
});

module.exports = {
 'successlog': successLogger
};

Also in my object is displaying the time correctly (hour and minutes)


 'access-file':
      EventEmitter {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        silent: false,
        raw: false,
        name: 'access-file',
        formatter: undefined,
        level: 'info',
        handleExceptions: false,
        exceptionsLevel: 'error',
        humanReadableUnhandledException: false,
        filename: 'info.log',
        _basename: 'info.log',
        dirname: './log',
        options: [Object],
        json: false,
        colorize: false,
        maxsize: null,
        logstash: null,
        maxFiles: null,
        label: null,
        prettyPrint: false,
        showLevel: true,
        timestamp: true,
        datePattern: 'yyyy-MM-dd-',
        depth: null,
        eol: '\r\n',
        maxRetries: 2,
        prepend: true,
        createTree: false,
        localTime: true,
        zippedArchive: false,
        maxDays: 0,
        _size: 68,
        _created: 0,
        _buffer: [Array],
        _draining: false,
        _failures: 0,
        _archive: false,
        _currentFiles: [Array],
        _year: 2017,
        _month: 9,
        _date: 3,
        _hour: 10,
        _minute: 39,
        _weekday: 'Tue',
        getFormattedDate: [Function],
        _onError: [Function: bound ],
        opening: true },
     'error-file':

my log file (at 10:39am on oct 3) 2017-10-03T17:39:27.879Z - info: Usuario prueba creado por: ramon

Why is my file showing utc time? I checked utc time right now and its the same as the one on my log file

1reaction
mattberthercommented, Sep 11, 2017

@LukeXF winston-daily-rotate-file does not use the timezone by moment. Depending on the value of the localTime option, the timezone used will be either UTC or the timezone of the server running the component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Handle Timezones and Synchronize Your Software ...
In this article, I'll introduce time zone issues and share some rules to follow. Quick introduction to time zones. As the earth is...
Read more >
Time Zone Issue - Microsoft Community
Time Zone Issue. Hello. I have a Windows 10 operating system, and after a recent update, my computer was displaying the wrong time....
Read more >
Days since last timezone issue : r/ProgrammerHumor - Reddit
I haven't had any timezone issues since December 31, 1969.
Read more >
Big problems at the timezone database
The last time I wrote about the timezone database on this blog, the database was under threat from a lawsuit. Fortunately that lawsuit...
Read more >
how do you deal with timezone issues? - Stack Overflow
Everything in UTC, and another column for the offset.
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