1 package ch.qos.logback.access.pattern; 2 3 import ch.qos.logback.access.spi.AccessEvent; 4 import ch.qos.logback.core.util.OptionHelper; 5 6 7 public class RequestAttributeConverter extends AccessConverter { 8 9 String key; 10 11 public void start() { 12 key = getFirstOption(); 13 if (OptionHelper.isEmpty(key)) { 14 addWarn("Missing key for the request attribute"); 15 } else { 16 super.start(); 17 } 18 } 19 20 public String convert(AccessEvent accessEvent) { 21 if (!isStarted()) { 22 return "INACTIVE_REQUEST_ATTRIB_CONV"; 23 } 24 25 return accessEvent.getAttribute(key); 26 } 27 28 }