mattiash / docker-pino-sample Goto Github PK
View Code? Open in Web Editor NEWSample code for logging with pino from a docker container
Home Page: https://mattias.holmlund.se/2019/01/logging-with-pino-from-docker/
Sample code for logging with pino from a docker container
Home Page: https://mattias.holmlund.se/2019/01/logging-with-pino-from-docker/
This is not necessarily an issue, just looking for some clarification on a few things based on my specific setup.
I'm using the node:12.18.0-alpine
image and noticed that the entrypoint.sh script doesn't work, it produces the following error: "env: can't execute 'bash': No such file or directory"
Changing the header of the script to #!/bin/sh
get it to execute the script, but it errors on L18: "bin/sh syntax error: unexpected redirection". Seems like the redirection on L18 of entrypoint.sh is a feature specifically available in bash and not in sh.
I'm curious what the > >
is doing in this command - I've used single >
in commands before when sending output of a script to a file for example, but haven't seen double with a space like this before...
node build/index.js > >(./node_modules/.bin/pino-pretty -t) &
I noticed that pino recommends here in their docs to use pipe |
to offload the transport to a separate process from the main node app. Does < <
redirection have the same effect, but additionally allow for catching of the SIGTERM and ability to pass it along to the node process?
I.e. i'm wondering if there would be any performance difference between this command:
node build/app.js | node build/utils/logTransport.js
and:
node build/app.js > >(node build/utils/logTransport.js) &
worker="$!"
Note: in the example above logTransport.js
is a custom log formatter, doing a similar job to pino-pretty
in the example in this repo.
@albertkang wrote in pinojs/pino#350 (comment)
@mattiash, using your solution if my node process exits, i.e., process.exit(1) - the entrypoint shell does not exit and I'm left with a container is still running. How can I change your script to exit the shell as well?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.