File tree 1 file changed +5
-4
lines changed
packages/sumi-core/src/server/logs-core
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ import { DEFAULT_LOG_FOLDER, LogService } from './log.service';
14
14
@Injectable ( )
15
15
export class LogServiceManager implements ILogServiceManager {
16
16
@Autowired ( ServerConfig )
17
- private serverConfig : ServerConfig ;
17
+ // 卸载时会有时序问题导致 serverConfig 被销毁,这边改为 Optional
18
+ private serverConfig ?: ServerConfig ;
18
19
19
20
protected readonly logLevelChangeEmitter = new Emitter < LogLevel > ( ) ;
20
21
private globalLogLevel : LogLevel ;
@@ -25,8 +26,8 @@ export class LogServiceManager implements ILogServiceManager {
25
26
26
27
constructor ( ) {
27
28
this . init ( {
28
- logDir : this . serverConfig . logDir ,
29
- logLevel : this . serverConfig . logLevel ,
29
+ logDir : this . serverConfig ? .logDir ,
30
+ logLevel : this . serverConfig ? .logLevel ,
30
31
} ) ;
31
32
this . cleanOldLogs ( ) ;
32
33
}
@@ -35,7 +36,7 @@ export class LogServiceManager implements ILogServiceManager {
35
36
this . logRootFolderPath = options . logDir || DEFAULT_LOG_FOLDER ;
36
37
this . logFolderPath = this . _getLogFolder ( ) ;
37
38
this . globalLogLevel = options . logLevel || LogLevel . Info ;
38
- this . LogServiceClass = this . serverConfig . LogServiceClass || LogService ;
39
+ this . LogServiceClass = this . serverConfig ? .LogServiceClass || LogService ;
39
40
} ;
40
41
41
42
getLogger = (
You can’t perform that action at this time.
0 commit comments