Under what conditions is app.setBannerMode(Banner.Mode.OFF); ignored? - spring-boot

I am calling app.setBannerMode(Banner.Mode.OFF); in my application but I still get a banner.
My code:
SpringApplication app = new SpringApplication(MyApp.class);
app.setBannerMode(Banner.Mode.OFF);
app.setAdditionalProfiles("foobar");
Output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.8.RELEASE)
Expected output:
(nothing)
What could be causing this?!

Related

Cannot set application properties via mvn release plugin

In CI part most of the times I prefer standard maven phases to execute build steps. In these cases I override application.properties e.g.: -Dlogging.level.root=OFF -Dspring.main.banner-mode=off to turn off debugging logs and save some precious build time.
In some pipelines I prefer to use maven release plugin and I noticed that these flags does not work there.
e.g.: mvn release:prepare -Dspring.main.banner-mode=off
[INFO]
[INFO] . ____ _ __ _ _
[INFO] /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
[INFO] ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[INFO] \\/ ___)| |_)| | | | | || (_| | ) ) ) )
[INFO] ' |____| .__|_| |_|_| |_\__, | / / / /
[INFO] =========|_|==============|___/=/_/_/_/
[INFO] :: Spring Boot :: (v2.1.4.RELEASE)
[INFO]
Still display spring banner
Any suggestion?

Bash complains about syntax errors in here-document when using backticks

I'm running the following piece of bash code:
cat << END_TEXT
_ _
| | | |
__ _| |__ ___ __| |
/ _` | '_ \ / __/ _` |
| (_| | |_) | (_| (_| |
\__,_|_.__/ \___\__,_|
END_TEXT
and am getting an error:
bash: command substitution: line 1: syntax error near unexpected token `|'
bash: command substitution: line 1: ` | '_ \ / __/ _'
No need to escape backticks. Just use quoted here-doc string as:
cat <<-'END_TEXT'
_ _
| | | |
__ _| |__ ___ __| |
/ _` | '_ \ / __/ _` |
| (_| | |_) | (_| (_| |
\__,_|_.__/ \___\__,_|
END_TEXT
As per man bash:
If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and `.
It's the backticks. Most content in a here-document is not intrepreted and used as-is, but backticks change this.
The solution: Escape them, even though it messes up the layout of your script:
cat << END_TEXT
_ _
| | | |
__ _| |__ ___ __| |
/ _\` | '_ \ / __/ _\` |
| (_| | |_) | (_| (_| |
\__,_|_.__/ \___\__,_|
END_TEXT

How can I change serenity-bdd log settings in maven

Were using serenity-bdd, and log analysis is important. But there is a lot of spam in the logging:
Serenety uses a lot of asci art in there logging witch is in my case waste of space and giving a lot of noice:
end2endtests | _____ _____ ____ _____ ____ _____ _ ____ _____ _____ ____
end2endtests | |_ _| ____/ ___|_ _| / ___|_ _|/ \ | _ \_ _| ____| _ \
end2endtests | | | | _| \___ \ | | \___ \ | | / _ \ | |_) || | | _| | | | |
end2endtests | | | | |___ ___) || | ___) || |/ ___ \| _ < | | | |___| |_| |
end2endtests | |_| |_____|____/ |_| |____/ |_/_/ \_\_| \_\|_| |_____|____/
end2endtests |
end2endtests |
And then on the end we get:
end2endtests | __ _____ _____ ____ _____ ____ _ ____ ____ _____ ____
end2endtests | _ \ \ |_ _| ____/ ___|_ _| | _ \ / \ / ___|/ ___|| ____| _ \
end2endtests | (_)_____| | | | | _| \___ \ | | | |_) / _ \ \___ \\___ \| _| | | | |
end2endtests | _|_____| | | | | |___ ___) || | | __/ ___ \ ___) |___) | |___| |_| |
end2endtests | (_) | | |_| |_____|____/ |_| |_| /_/ \_\____/|____/|_____|____/
end2endtests | /_/
end2endtests |
end2endtests | TEST PASSED
We do this in our Jenkins server trough a Maven command, I realy would like to reduce this noice so we have a bit less logging and sutch. I been googeling for it but havent found a clear cut answer that gave me the insight.
You need to pass -Dserenity.console.headings=minimal or -Dserenity.console.headings=normal in command line.
Or use
System.SetProperty("serenity.console.headings", "normal");
See below for more details
http://thucydides.info/docs/serenity-staging/
You can use below properties in serenity.properties file to turn off logging in reporting. (Serenity model/core version: 2.2.5)
serenity.console.headings=none to turn off the TEST STARTED banner and serenity.console.banner=none to turn off the SERENITY BDD banner.
Reference:
https://www.javadoc.io/doc/net.serenity-bdd/serenity-model/latest/net/thucydides/core/ThucydidesSystemProperty.html

spring boot server stops after main method execution

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.3.RELEASE)
(application stops after main class execution.)

Initialize gem Artii on a File (Ruby)

I know that I can initialize artii on the cmd with:
artii "word"
And WORD appears, but I cant find how to do this directly from a .rb file.
Artii::Base#asciify returns a formatted string:
require 'artii'
a = Artii::Base.new
a.asciify('word')
#=> " _ \n | |\n __ _____ _ __ __| |\n \\ \\ /\\ / / _ \\| '__/ _` |\n \\ V V / (_) | | | (_| |\n \\_/\\_/ \\___/|_| \\__,_|\n \n "
You have to print it in order to see the formatting:
puts a.asciify('word')
Output:
_
| |
__ _____ _ __ __| |
\ \ /\ / / _ \| '__/ _` |
\ V V / (_) | | | (_| |
\_/\_/ \___/|_| \__,_|

Resources