03 August 2016


colored log(back) for unit tests in two steps




The goal

Make my own stuff yellow, and keep the other stuff grey.



1. src/test/resources/logback.groovy
(modify the namespace you wanna highlight as your own)

import ch.qos.logback.classic.boolex.GEventEvaluator
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.ConsoleAppender
import ch.qos.logback.core.filter.EvaluatorFilter
import static ch.qos.logback.classic.Level.DEBUG
import static ch.qos.logback.core.spi.FilterReply.DENY
import static ch.qos.logback.core.spi.FilterReply.NEUTRAL
appender("CONSOLE", ConsoleAppender) {
encoder(PatternLayoutEncoder) {
pattern = "[%thread] %-5level %logger{15} - %msg %n" }
filter(EvaluatorFilter) {
evaluator(GEventEvaluator) {
expression = "!(e.getLoggerName().contains('com.finnjohnsen'))" }
onMismatch = DENY onMatch = NEUTRAL }
}
appender("COLOR_CONSOLE", ConsoleAppender) {
withJansi = true encoder(PatternLayoutEncoder) {
pattern = "[%thread] %highlight(%-5level) %boldWhite(%logger{15}) - %boldYellow(%msg) %n" }
}
root(DEBUG, ["CONSOLE"])
logger("com.finnjohnsen", DEBUG, ["COLOR_CONSOLE"])
view raw logback.groovy hosted with ❤ by GitHub



2. Add this to your build.gradle (in addition to logback):
testCompile "org.fusesource.jansi:jansi:1.12"


Done.

05 May 2016

Windows 10 - United States International AltGr No Dead Keys

I use US keyboard. However I loose my native æøå letters if I use standard US layout. AltGR No Dead Keys fixes this problem.
AltGR + z makes the "æ"
AltGr + l makes the "ø"
AltGr + w makes the "å"

Holding shift makes them uppercased.

I couldn't figure out how to use the .klc file I've used in previous Windows versions. So I ended up having to make a .msi installer in "Microsoft Keyboard Layout Creator". Tedious stuff, so I decided to put it in my blog where I (and maybe you) can get it from in the future.








USIntNDK_amd64.msi


PS. You shouldn't trust executables from random blogs, like here. So honoring that best practice I recommend you use the .klc keyboard layout file and create the .msi using Microsoft Keyboard Layout Creator yourself.