Questions tagged [log4js-node]

log4js-node is a logging framework for Node.js. (Not to be confused with log4js, since log4js-node is a different software.)

log4js-node is a conversion of the log4js framework to work with node.

121 questions
1
vote
1 answer

Node js Syntax error unexpected token?

Everything in my code and log4js file seems to be fine and syntactically correct. However, when running my app, I get this following error: undefined:1 ?{ ^ SyntaxError: Unexpected token ? It happens when I get to this line: var logFile = 'log4js_'…
Daniel
  • 631
  • 9
  • 20
1
vote
1 answer

log4js configure function error [NodeJs]

I am getting the following error in console window when running my NodeJs application. I am using log4js for logging. Runtime platform is express. Error: undefined:1 ?{ ^ SyntaxError: Unexpected token ? in JSON at position 0 Code: var log4js =…
sam jack
  • 11
  • 2
1
vote
1 answer

Send JSON from log4js to logstash and fields

I'm using log4js to log my application and I'd like to send logs to logstash. Here is a defalt appender for log4js from here: "appenders": [ { "type": "console" }, { "host": "127.0.0.1", "port": 5000, "type":…
nkint
  • 11,513
  • 31
  • 103
  • 174
1
vote
1 answer

Logging server status

I am currently adding logs in my application using log4js (not the default sails logger). I'd like to be able to keep track of the server status : when it's up and down. Where should I put the logs to be able to know when the server is down? Thanks…
krakig
  • 1,515
  • 1
  • 19
  • 33
1
vote
1 answer

passing string in node.js

I am newbee to node.js and using log4js for logging in my example application. Following is my code. logger.js file has following code. var log4js = require('log4js'); log4js.configure({ appenders: [{ type: 'console' }, { type:…
1
vote
1 answer

How to use non SMTP transport in log4js smtp appender?

If you read the log4js documentation for SMTP appender, you'll see example for SMTP transport, which even does not work well with latest nodemailer (I'm using nodemailer 1.3.0 at the time of writting). Docs show this bad config as an example: {…
Nikola M.
  • 573
  • 6
  • 16
1
vote
1 answer

log4js ConsoleAppender initialization

I'm wondering if anyone happens to have some experience using Log4js? It seems its normal ConsoleAppender isn't always ready to use immediately after it's added to a logger object... If I have two sequential script tags in a document…
Purrell
  • 12,461
  • 16
  • 58
  • 70
1
vote
0 answers

log4js (node) cannot send via SMTP appender with no auth

I'm using a port of log4js designed for javascript in node and am having some trouble using the SMTP appender where the SMTP relay does not use authentication Here is my configuration: "appenders": [ { "type": "smtp", "recipients":…
bustedware
  • 194
  • 1
  • 3
  • 18
1
vote
0 answers

How can I make log4js on cygwin write exactly what I want to file?

I have a node.js project on cygwin, which I test with mocha. My logger is log4js. I have an appender to get log4js to write to file, but I don't know how to get it to write it exactly as I want. Must-haves: A different file for each time mocha runs…
JXG
  • 7,263
  • 7
  • 32
  • 63
1
vote
1 answer

Log4js takes hours to write logfile

I am using log4js in my code to log the results and errors. The program runs for about 2,5 hours before the final console output is made and afterwards needs several hours to complete writing the logfile. The log is writing for 6 hours now (since…
1
vote
2 answers

Why is log4js creating an empty file but never putting messages into it?

log4js creates an empty file. I've looked at the answers to the (many) other times this happens to people on SO, but none seem relevant to me. Here is my code: // Configure logging. require('log4js').configure('log4js.json'); var logger =…
user3690202
  • 3,844
  • 3
  • 22
  • 36
0
votes
0 answers

log4js is not generating the file when pattern is set to dateFile format for date wise file creations

I am trying to create the log file based on the dates so that each datewise can store the logs I tried following configs but when I add the date pattern yyyy-MM-dd it is only creating the app.log file not the date file. Note: but when I use…
Bravo
  • 61
  • 2
  • 7
  • 26
0
votes
0 answers

How do we create a new log file every week using log4js

Following code doesn't work it prints ww instead of week number, same in case of pattern yyyy-MM-ww const log4js = require('log4js'); log4js.configure({ appenders: { weekly: { type: 'dateFile', filename: 'logs/app.log', …
SAN
  • 326
  • 6
  • 23
0
votes
1 answer

How can I remove a warning from to make a executable file of nodejs+express app?

experts, I got below warning from when I tried to make a executable file with nodejs+express app. The resulted exe file in windows has an error also. Please review and give your advice to resolve this. Warning message in making an exe file : >…
econuri
  • 21
  • 2
0
votes
0 answers

Log4js issue: Cannot read property 'native' of undefined

Am using Log4js in my Reactjs app. I have downloaded log4js (v@6.8.0) with Node(v@16.14.0). After importing getting following error. Any issue with current version of Log4js?
Shankar Nanda
  • 129
  • 4
  • 11
1 2 3
8 9