1
一個初始化中:不能引用靜態枚舉場Cbev2Key.log我目前正在使用@ Log4j2在我的枚舉類這樣
import lombok.extern.log4j.Log4j2;
@Log4j2
public enum Cbev2Key
{
....
....
}
我正在使用的代碼把這一情況記錄「日誌」變量這樣的構造:
CbeV2Key(final String value, final IonType type,final boolean isMandatoryKey)
{
if(StringUtils.isEmpty(value) || type == null) {
log.fatal("Empty/Null value/type not permitted value : " + value + " type : " + type);
}
this.type = type;
this.isMandatoryKey = isMandatoryKey;
}
在日誌變量它顯示我此錯誤
「不能引用靜態枚舉場Cbev2初始化程序中的Key.log。「
爲什麼我得到這個錯誤?
是的,這很好,但我在構造函數中提到的變量不是靜態的,這些都只是私有字段。 – mshikher
@mshikher'log'是靜態的。它在錯誤信息中。 –
我該如何解決這個問題?如果我不能這樣做,我該如何登錄? – mshikher