check isTraceEnabled before constructing a trace message