日志处理

This commit is contained in:
luying
2020-12-04 10:19:42 +08:00
parent 3f89085588
commit 77ad3d93ed
6 changed files with 313 additions and 4 deletions

View File

@@ -21,7 +21,13 @@ const filePath = (_pinus as any).FILEPATH;
filePath.MASTER = '/config/master';
filePath.SERVER = '/config/servers';
filePath.CRON = '/config/crons';
filePath.LOG = '/config/log4js';
if(process.env.NODE_ENV == 'local') {
filePath.LOG = '/config/log4js.local';
// } else if(process.env.NODE_ENV == 'prod'){
// filePath.LOG = '/config/log4js.prod';
} else {
filePath.LOG = '/config/log4js.prod';
}
filePath.SERVER_PROTOS = '/config/serverProtos';
filePath.CLIENT_PROTOS = '/config/clientProtos';
filePath.MASTER_HA = '/config/masterha';

View File

@@ -13,5 +13,8 @@ module.exports = [{
}, {
'type': 'gm',
'token': 'agarxhqb98rpajloaxn34ga8xrunpagkjwlaw3ruxnpaagl29w4rxn'
}, {
'type': 'role',
'token': 'agarxhqb98rpajloaxn34ga8xrunpagkjwlaw3ruxnpaagl29w4rxn'
}
];

View File

@@ -0,0 +1,134 @@
module.exports = {
'appenders': {
'console': {
'type': 'console'
},
'con-log': {
'type': 'file',
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
'pattern': 'connector',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'rpc-log': {
'type': 'file',
'filename': '${opts:base}/logs/rpc-log-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'forward-log': {
'type': 'file',
'filename': '${opts:base}/logs/forward-log-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'rpc-debug': {
'type': 'file',
'filename': '${opts:base}/logs/rpc-debug-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'crash-log': {
'type': 'file',
'filename': '${opts:base}/logs/crash.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'admin-log': {
'type': 'file',
'filename': '${opts:base}/logs/admin.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'pinus': {
'type': 'file',
'filename': '${opts:base}/logs/pinus-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'pinus-admin': {
'type': 'file',
'filename': '${opts:base}/logs/pinus-admin.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'pinus-rpc': {
'type': 'file',
'filename': '${opts:base}/logs/pinus-rpc-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
}
},
'categories': {
'default': {
'appenders': ['console', 'pinus'],
'level': 'debug'
},
'con-log': {
'appenders': ['con-log'],
'level': 'debug'
},
'rpc-log': {
'appenders': ['rpc-log'],
'level': 'debug'
},
'forward-log': {
'appenders': ['forward-log'],
'level': 'debug'
},
'rpc-debug': {
'appenders': ['rpc-debug'],
'level': 'debug'
},
'crash-log': {
'appenders': ['crash-log'],
'level': 'debug'
},
'admin-log': {
'appenders': ['admin-log'],
'level': 'debug'
},
'pinus-admin': {
'appenders': ['pinus-admin'],
'level': 'debug'
},
'pinus-rpc': {
'appenders': ['pinus-rpc'],
'level': 'debug'
},
},
'prefix': '${opts:serverId} ',
'replaceConsole': true,
'lineDebug': false,
'errorStack': true
};

View File

@@ -0,0 +1,166 @@
module.exports = {
'appenders': {
'console': {
'type': 'console'
},
'logger': {
'type': 'file',
'filename': '${opts:base}/logs/logger.log',
'pattern': 'connector',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'log': {
'type': 'file',
'filename': '${opts:base}/logs/log.log',
'pattern': 'connector',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'con-log': {
'type': 'file',
'filename': '${opts:base}/logs/con-log-${opts:serverId}.log',
'pattern': 'connector',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'rpc-log': {
'type': 'file',
'filename': '${opts:base}/logs/rpc-log-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'forward-log': {
'type': 'file',
'filename': '${opts:base}/logs/forward-log-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'rpc-debug': {
'type': 'file',
'filename': '${opts:base}/logs/rpc-debug-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'crash-log': {
'type': 'file',
'filename': '${opts:base}/logs/crash.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'admin-log': {
'type': 'file',
'filename': '${opts:base}/logs/admin.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'pinus': {
'type': 'file',
'filename': '${opts:base}/logs/pinus-default.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'error': {
'type': 'file',
'filename': '${opts:base}/logs/error.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'pinus-admin': {
'type': 'file',
'filename': '${opts:base}/logs/pinus-admin.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
},
'pinus-rpc': {
'type': 'file',
'filename': '${opts:base}/logs/pinus-rpc-${opts:serverId}.log',
'maxLogSize': 1048576,
'layout': {
'type': 'basic'
},
'backups': 5
}
},
'categories': {
'pinus': {
'appenders': ['console', 'pinus'],
'level': 'debug'
},
'con-log': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'rpc-log': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'forward-log': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'rpc-debug': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'crash-log': {
'appenders': ['console', 'crash-log'],
'level': 'debug'
},
'admin-log': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'pinus-admin': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'pinus-rpc': {
'appenders': ['console', 'log'],
'level': 'debug'
},
'logger': {
'appenders': ['console', 'logger'],
'level': 'error'
}
},
'prefix': '${opts:serverId} ',
'replaceConsole': true,
'lineDebug': false,
'errorStack': true
};

View File

@@ -28,8 +28,8 @@ export default (appInfo: EggAppInfo) => {
config.alinode = {
appid: '86043',
secret: '54ef0364995b0c4f2ab42150e29ad30df8327a3a',
error_log: [ '/root/logs/zyz/zyz-web.log', '/root/logs/zyz/common-error.log', '/root/logs/zyz/egg-agent.log' ],
packages: [ '/root/zyz/web-server/package.json' ],
error_log: [ '${appInfo.root}/logs/${appInfo.name}/zyz-web.log', '${appInfo.root}/logs/${appInfo.name}/common-error.log', '${appInfo.root}/logs/${appInfo.name}/egg-agent.log' ],
packages: [ '${appInfo.baseDir}/package.json' ],
};
config.view = {

View File

@@ -1,5 +1,5 @@
{
"name": "zyz",
"name": "web-server",
"version": "1.0.0",
"description": "zyz-web-server",
"private": true,