Tag: logging

JavaScript日志库在节点和浏览器上工作

我们目前正在使用Visionmedias debug -library,因为它可以在浏览器和nodejs上运行。 有没有任何比debugging更强大的库,并在两端工作? 至lessdebugging级别(错误,警告,信息等)是至关重要的。 当然,浏览器和服务器configuration不同也是很好的做法。 我们的应用程序是同构stream派/反应复杂的,所以我们需要一个适合两端的库。

如何从heroku上的NodeJS应用程序删除socket.io轮询日志?

Heroku不支持websocket,所以在使用socket.io时,我的日志变得超级混乱/socket.io/行。 我怎样才能让他们离开? 2015-05-26T20:57:50.842359+00:00 heroku[router]: at=info method=POST path="/someUsername/today/update" host=complice.co request_id=48483d1f-5389-4dc9-a7e2-0dd975e4cdaf fwd="132.205.236.27" dyno=web.1 connect=2ms service=57ms status=200 bytes=366 2015-05-26T20:57:50.846807+00:00 app[web.1]: 10.69.24.23 – – [26/May/ 2015:20:57:50 +0000] "POST /someUsername/today/update HTTP/1.1" 200 17 2015-05-26T20:57:52.471715+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=2&transport=websocket&sid=sLY-oQMlHNsorbKEAAAh" host=complice.co request_id=8c937877-e06f-4503-b8af-a83a070d6aa0 fwd="184.175.46.182" dyno=web.1 connect=1ms service=2125530ms status=101 bytes=504 2015-05-26T20:58:00.584527+00:00 heroku[router]: at=info method=GET path="/socket.io/?EIO=2&transport=websocket&sid=pBl47HfKOimvv1V6AAAK" host=complice.co request_id=753f792d-e713-4086-901b-23727ee84a5e fwd="184.175.46.182" dyno=web.1 connect=1ms service=2136303ms status=101 bytes=636 2015-05-26T20:58:05.233626+00:00 […]

在sails中logging响应状态

我正在尝试logging对我的sails应用程序所做的每个请求,但是我找不到logging与请求相关联的响应的方法。 我在config / http.js文件中添加了这个自定义中间件: myRequestLogger: function (req, res, next) { req.on("end", function(){ sails.log(res.statusCode); }); return next(); } 但它不能正常工作,我可以得到200代码,但res.forbidden或res.notFound响应不logging。 任何关于如何处理的想法? 谢谢

NodeJS + GCloud日志logging中的内存泄漏

我一直在为我们的生产代码寻找2个弱点的内存泄漏。 最后,我用简单的nodejs服务器和gcloud logging api重现了内存泄漏。 Nodejs服务器与“Nodejs入门指南”中的内容相同 'use strict'; const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n'); }); server.listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); }); module.exports = server; 我写每个请求标题gcloud日志logging: 'use strict'; const app = require('./app.js'); const […]

温斯顿logger.info不是一个函数

我已经build立了Winston的传输到MySQL和控制台,并把它放在一个名为logger的模块。 像这样… // modules/logger.js /* require statements */ exports.logger = new (winston.Logger)({ transports: [ new winstonMysql(winstonMysqlConfig), new (winston.transports.Console) ] }); 然后在/modules // modules/index.js /* grab other modules */ exports.logger = require('./logger.js'); 当我做console.log(modules.logger) ,我得到这个 { logger: EventEmitter { … error: [Function], warn: [Function], info: [Function], verbose: [Function], debug: [Function], silly: [Function], … } } 但是当我调用modules.logger.info()它会引发modules.logger.info is […]

如何login – 十二因素的应用方式

我想知道logging我的节点应用程序背后的最佳实践。 我在https://12factor.net/logs上阅读了12个因子的应用指南,它指出日志应该总是被发送到stdout 。 很酷,但是那么如何pipe理生产中的日志呢? 有没有一个应用程序可以获取发送到stdout任何内容? 另外,build议我只loggingstdout而不是stderr ? 对于这个问题,我会很感激。

winston + PM2logginguncaughtException两次

我为我的NodeJS应用程序使用winston ,以具有结构化日志logging格式(JSON),稍后我将通过Filebeat处理并发送到Logstash。 正如PM2和12factor.net所build议的,我使用winston.transports.Console传输进行日志logging,并让PM2处理我的winston.transports.Console的stdout和stderr 。 在我的logger.js模块中,我有以下几点: "use strict"; const winston = require("winston"); // Remove logging on console winston.remove(winston.transports.Console); // env const env = process.env.NODE_ENV || 'development'; const isDev = env === "development"; // The default Console transport const defaultLogLevel = isDev ? "debug" : "info"; const consoleTransport = new winston.transports.Console({ level: defaultLogLevel, colorize: true, json: true, […]

用Winstonjslogging器logging节点给TypeError

我刚刚开始与节点,我现在想要添加一些日志到我的应用程序,为此Winstonjs似乎是一个完美的契合。 所以我第一次安装它: npm install winston 然后我复制自述文件中的第一个示例代码(并在之前添加了require): "use strict"; let winston = require('winston'); const logger = winston.createLogger({ level: 'info', format: winston.format.json(), transports: [ // // – Write to all logs with level `info` and below to `combined.log` // – Write all logs error (and below) to `error.log`. // new winston.transports.File({ filename: 'error.log', level: 'error' }), new […]

日志logging系统nodejs和节点worker

nodejs日志系统,我想要一个漂亮的控制台日志logging,也可以保存到日志文件,也快,asynchronous会更好。 最困难的是node-worker ,它使用std io与父进程进行通信,所以如果使用std io的日志系统不能工作。

存储日志,nodeJS postgreSQL vs noSQL

我的node.js应用程序正在生成大量的文本日志(每个用户每天100个)。 我每天有10k个活跃用户,每天大约有10万个日志,供我的应用程序存储。 格式化如下: time | log_type_id | action_id | message | user_ip 无法归档。 大部分日志数据必须可用于显示给用户。 问题是什么是最快,最有效的磁盘空间和性能明智的方式来存储日志? 奖金问题什么是最好的sorting方式,分析所有这些数据?