{"action":"created","issue":{"url":"https://api.github.com/repos/log4js-node/log4js-node/issues/782","repository_url":"https://api.github.com/repos/log4js-node/log4js-node","labels_url":"https://api.github.com/repos/log4js-node/log4js-node/issues/782/labels{/name}","comments_url":"https://api.github.com/repos/log4js-node/log4js-node/issues/782/comments","events_url":"https://api.github.com/repos/log4js-node/log4js-node/issues/782/events","html_url":"https://github.com/log4js-node/log4js-node/issues/782","id":352059718,"node_id":"MDU6SXNzdWUzNTIwNTk3MTg=","number":782,"title":"loadAppenderModule Webpack not working anymore","user":{"login":"farfromrefug","id":655344,"node_id":"MDQ6VXNlcjY1NTM0NA==","avatar_url":"https://avatars0.githubusercontent.com/u/655344?v=4","gravatar_id":"","url":"https://api.github.com/users/farfromrefug","html_url":"https://github.com/farfromrefug","followers_url":"https://api.github.com/users/farfromrefug/followers","following_url":"https://api.github.com/users/farfromrefug/following{/other_user}","gists_url":"https://api.github.com/users/farfromrefug/gists{/gist_id}","starred_url":"https://api.github.com/users/farfromrefug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farfromrefug/subscriptions","organizations_url":"https://api.github.com/users/farfromrefug/orgs","repos_url":"https://api.github.com/users/farfromrefug/repos","events_url":"https://api.github.com/users/farfromrefug/events{/privacy}","received_events_url":"https://api.github.com/users/farfromrefug/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-20T09:45:31Z","updated_at":"2018-11-27T03:48:41Z","closed_at":"2018-10-08T20:34:53Z","author_association":"NONE","body":"In old version of log4js (before the recent refactor), we could \"override\" ```Configuration.prototype. loadAppenderModule``` to load appenders and fix webpack issues.\r\n\r\nFor example I was doing this\r\n```\r\n//webpack fix\r\nconst stdoutAppender = require('log4js/lib/appenders/stdout');\r\nconst fileAppender = require('log4js/lib/appenders/file');\r\nconst consoleAppender = require('log4js/lib/appenders/console');\r\nconst Configuration = require('log4js/lib/configuration');\r\nconst oldLoadAppenderModule = Configuration.prototype.loadAppenderModule;\r\nConfiguration.prototype.loadAppenderModule = function (type) {\r\n    if (type === 'stdout') {\r\n        return stdoutAppender;\r\n    } else if (type === 'file') {\r\n        return fileAppender;\r\n    } else if (type === 'console') {\r\n        return consoleAppender;\r\n    }\r\n    return oldLoadAppenderModule.call(this, type);\r\n};\r\n``` \r\nNow it is not working anymore.\r\nHow can I achieve the same result with the latest version?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/log4js-node/log4js-node/issues/comments/441892830","html_url":"https://github.com/log4js-node/log4js-node/issues/782#issuecomment-441892830","issue_url":"https://api.github.com/repos/log4js-node/log4js-node/issues/782","id":441892830,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTg5MjgzMA==","user":{"login":"mhahn-sighthoundlabs","id":5777789,"node_id":"MDQ6VXNlcjU3Nzc3ODk=","avatar_url":"https://avatars2.githubusercontent.com/u/5777789?v=4","gravatar_id":"","url":"https://api.github.com/users/mhahn-sighthoundlabs","html_url":"https://github.com/mhahn-sighthoundlabs","followers_url":"https://api.github.com/users/mhahn-sighthoundlabs/followers","following_url":"https://api.github.com/users/mhahn-sighthoundlabs/following{/other_user}","gists_url":"https://api.github.com/users/mhahn-sighthoundlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/mhahn-sighthoundlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhahn-sighthoundlabs/subscriptions","organizations_url":"https://api.github.com/users/mhahn-sighthoundlabs/orgs","repos_url":"https://api.github.com/users/mhahn-sighthoundlabs/repos","events_url":"https://api.github.com/users/mhahn-sighthoundlabs/events{/privacy}","received_events_url":"https://api.github.com/users/mhahn-sighthoundlabs/received_events","type":"User","site_admin":false},"created_at":"2018-11-27T03:48:41Z","updated_at":"2018-11-27T03:48:41Z","author_association":"NONE","body":"This works if someone does not need any other core appender, for which there is no clean way to get to that list at this moment, since it's all internal in _log4js/lib/appenders/index.js_:\r\n\r\n```\r\nconst coreAppenders = new Map();\r\ncoreAppenders.set('console', require('./console'));\r\ncoreAppenders.set('stdout', require('./stdout'));\r\ncoreAppenders.set('stderr', require('./stderr'));\r\ncoreAppenders.set('file', require('./file'));\r\ncoreAppenders.set('dateFile', require('./dateFile'));\r\n```\r\n\r\nIt can be accomplished with some dirty webpack moves:\r\n\r\n```\r\n        test: /log4js\\/lib\\/appenders\\/index\\.js$/,\r\n        loader: \"string-replace-loader\",\r\n        options: {\r\n            search: \"coreAppenders.set('dateFile', require('./dateFile'));\",\r\n            replace: \"coreAppenders.set('dateFile', require('./dateFile')); \" +\r\n                     \"coreAppenders.set('logLevelFilter', require('./logLevelFilter'));\"\r\n        }\r\n```\r\n\r\nFar from ideal though, so having a better/official way to do this would be great."}}
{"actor":{"display_login":"mhahn-sighthoundlabs"}}