fgm / filog

A fine logger package for Meteor.JS applications (client + server)
GNU General Public License v3.0
18 stars 6 forks source link

App source code included in logs #56

Open arggh opened 6 years ago

arggh commented 6 years ago

I'm wondering, is it intentional to include app source code in the log messages?

 {
    "_id": "eLnvfTgZhHDZtLWQ6",
    "level": 3,
    "message": "t.target.closest is not a function",
    "context": {
        "message_details": {
            "mode": "stack",
            "name": "TypeError",
            "message": "t.target.closest is not a function",
            "stack": [
                {
                    "url": "https://myapp.com/66c8e63c0bcd217ad90172f6c531842452b03a9e.js?meteor_js_resource=true",
"func": "b",
                    "args": [],
                    "line": 193,
                    "column": 240691,
                    "context": [
                        "",
                        "!function(){var e=Package.meteor.Meteor,t=Package.meteor.global,i=Package.meteor.meteorEnv,n=Package.mongo.Mongo,r=Package.modules.meteorInstall,o=Package[\"babel-runtime\"].meteorBabelHelpers,a=Package.promise.Promise,s=Package[\"ecmascript-runtime-client\"].Symbol,l=Package[\"ecmascript-runtime-client\"].Map,u=Package[\"ecmascript-runtime-client\"].Set,d,c,p,f,m,h,y,g,v,b,S,I,w,k,N,E,T,B,C,U,A,x,O,z,j,F,R,P,D,M,L,G,W,V,q,H,K,Y,$,J,Z,Q,X,ee,te,ie,ne,re,oe,ae,se,le,ue,de,ce,pe,fe,me,he,ye,ge,ve,be,Se,Ie,we,ke,Ne,Ee,Te,Be,Ce,Ue,Ae,_e,xe,Oe,ze,je,Fe,Re,P............
fgm commented 6 years ago

I would say it is intentional in the component which captures the stack traces (callsite and/or tracekit): filog does not act on the stacks itself. However, since this can lead to high data volume, you can add a processor to your logger to slice or otherwise reduce the context volume during logging.

Notice that there is ongoing work in #23 and #27 to structure the context better. The current situation, especially for combined logging chains with processors on both client and server, leads to context formats that are a bit strange.

Our main app using filog is being modified these days to have a completely custom context format using a bespoke processor on the server in order to have exactly what we want in logs, and not more, to reduce the work done to post-normalize them in Logstash: this is something you might want to consider too.