You can put those headers into the MDC, then use them in the pattern.
In your service:
MDC.put("header1", header1);
MDC.put("header2", header2);
In your logback config:
<Pattern>%d [%thread] %level %class\(%method\) %line - %X{header1} %X{header2} %m%n</Pattern>
More info on the MDC and how to use it can be found in the documentation.