搜索            

无为论坛,没有版主,不删贴不封ID,北美中文论坛,加拿大中文论坛,红卫兵rolia,找工作,面试,职场,学英语,股市,炒股,心态,沟通

无为论坛,没有版主,不删贴不封ID,北美中文论坛,加拿大中文论坛,红卫兵rolia,找工作,面试,职场,学英语,股市,炒股,心态,沟通

Avatar

improper logging adds complexity (IT)

by super(学霸) ⌂, 2014-10-08 06:20 @ 学霸
edited by 学霸, 2014-10-18 13:49

Even though the following code has a lot of log statements, you don't know what values the System properties are set to and you don't know how the trade date is defaulted. If things don't work as expected, the log messages give you no clue at all.

static {
useBusinessDate = System.getProperty("useBusinessDate"; );

overrideTradeDate= System.getProperty("overrideTradeDate"; );
if(overrideTradeDate != null) {
//Check here to see the string is in YYYY-MM-DD format
isOverrideTradeDateValid = isValidDate(overrideTradeDate);
if (isOverrideTradeDateValid) {
_logger.info("OverrideTradeDate flag set, hence trade date being used : " + overrideTradeDate);
} else {
_logger.error("OverrideTradeDate flag set but date not in YYYY-MM-DD format, so using Local Server date as Trade date" );
}
}
}

public static LocalDate getTradeDate() {
if(overrideTradeDate != null ) {
if (isOverrideTradeDateValid) {
_logger.info("Trade date defaulted to : " + overrideTradeDate);
return new LocalDate(overrideTradeDate);
} else {
_logger.info("Trade date defaulted to : " + new LocalDate());
return new LocalDate();
}
} else if("Y".equalsIgnoreCase(useBusinessDate)) {
String tradeDate = TradeDateSolaceListener.tradeDateMap.get("TradeDate" );

if(StringUtils.isNotBlank(tradeDate)) {
_logger.info("Trade date defaulted to : " + tradeDate);
return new LocalDate(tradeDate);

} else {
_logger.info("Trade date defaulted to : " + new LocalDate());
return new LocalDate();
}
} else {
_logger.info("Trade date defaulted to : " + new LocalDate());
return new LocalDate();
}
}

---
serve the people

Tags:

IT, IT入门, 找工, 面试, 中介, 程序员, 码工, 电脑工作, job, interview, confidence

  750 views

整个话题:

 RSS Feed of thread

 
[x]