This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Alcor Controller Logging
kimeunju108 edited this page Feb 11, 2020
·
1 revision
To configure a logging system, modify the following property files:
-
src/resource/ application-k8s-template.properties //Kubernetes & cluster setup
-
src/resource/application-onebox.properties //Local setup
-
Configuration properties
-
Logging level – start log level, lower level of logs than this logging level are filtered.
-
Logging level of web
-
logging.type – console or file logging
-
Log file location when logging type is file
logging.level.root=info logging.level.org.springframework.web=info logging.file.path=/var/log logging.type=file
-
import com.futurewei.alcor.controller.logging.Logger; import com.futurewei.alcor.controller.logging.LoggerFactory;
Logger logger = LoggerFactory.getLogger();
-
Function formats
log(Level level, String msg) log(Level level, String msg, Object s) log(Level level, String msg, Throwable e) entering(String sourceClass, String sourceMethod) exiting(String sourceClass, String sourceMethod)
-
e.g.)
logger.log(Level.INFO, "Alcor Controller Log Started!"); logger.exiting(this.getClass().getName(), e.getStatus()); logger.exiting(this.getClass().getName(), e); logger.entering(this.getClass().getName(),"PushNetworkResourceStates()"); logger.exiting(this.getClass().getName(),"PushNetworkResourceStates()");
sudo docker logs alcor-controller
-
Get an alcor controller pod name.
Kubectl get pods
-
run following commands to see console logs
kubectl logs my-pod kubectl logs my-pod -c my-container
-
e.g.)
kubectl logs alcor-5c9746c7b9-fmg2s kubectl logs alcor-5c9746c7b9-fmg2s -c alcor
-
run following commands to see file logs
//1 container in a pod kubectl exec my-pod -- ls /var/log kubectl exec alcor-5c9746c7b9-fmg2s -- vi /var/log/AlcorLog-2020-02-10.log // multiple containers in a pod) kubectl exec my-pod -c my-container -- ls /var/log kubectl exec my-pod -c my-container -- vi /var/log/AlcorLog-2020-02-10.log
-
e.g.)
kubectl exec alcor-5c9746c7b9-fmg2s -c alcor -- ls /var/log kubectl exec alcor-5c9746c7b9-fmg2s -- vi /var/log/AlcorLog-2020-02-10.log kubectl exec alcor-5c9746c7b9-fmg2s -c alcor -- cat /var/log/AlcorLog-2020-02-10.log