How to disable Atomikos logfile when running Spring Boot with Atomikos JTA - spring-boot

I am using Spring Boot with Atomikos with embeded undertow server.I will be running my application in docker as a executable jar.We are writing all our logs as Sysout basically we are flushing and not writing any log files.But Atomikos is creating 3 log files when start and run application under my working directory.
How to disable creation of this log files. We should not create any physical log files in Disk.
or
Is there any way I can make these logs will be written in console instead of creating physical file.
Tried below configuration but it's not working.
com:
atomikos:
icatch:
enable_logging=false

You should run with -Dcom.atomikos.icatch.enable_logging=false as Atomikos itself does not read your application.yml so it will not read properties from there. Spring doesn't set this property either. A bit warning though, right from Atomikos documentation:
Specifies if disk logging should be enabled or not. Defaults to true.
It is useful for JUnit testing, or to profile code without seeing the
transaction manager's activity as a hot spot but this should never be
disabled on production or data integrity cannot be guaranteed.
Transaction logs are as important as data as they're used to recover from failures.

Related

Is there a pitfall to using two Hikari connection pools pointing to the same db?

In a Spring Boot application using Log4j2, I have setup a DataSource via yaml-configuration. But since Log4j2 needs a connection pool already in the startup phase for its JDBC Appender, a second data source must be provided separately. This results in the application having two connection pools running, both writing to the same database.
My first question is:
Are there any concerns about this setup, or is this the normal approach anyway?
Alternatively, the following setup would come to mind: we programmatically initialize the DataSource, so that we have access to it. Further on, we can then programmatically extend the existing Log4j2 configuration that doesn't have a JDBC Appender yet. By doing so we can pass the pooled DataSource that we also use for the application itself.
My second question is therefore:
Are there any caveats to using the same DataSource for both the application and the Log4j2 logging framework?
Many thanks for any information that helps to clarify the situation.

how disable 'attempting to receive mail from folder' spring integration mail in spring boot

i need to disable "attempting to receive mail from folder " log in spring integration.
Because it writes a lot of logs in catalina.out Tomcat and increases the file size.
See more info in the issue you have raised: https://github.com/spring-projects/spring-integration/issues/3430.
This is not an INFO starting with Spring Integration version 5.4.
As a workaround you can just disable logging for the AbstractMailReceiver class making it on the, let's say, WARN level.
According your tags in the question, you probably use Spring Boot, so its configuration property for the logging may look like this:
logging.level.org.springframework.integration.mail.AbstractMailReceiver=warn
and you won't see that INFO message in logs any more.

Is it possible to disable a Spring Boot datasource configuration based on unavailability of a connection to a DB

We have an application that uses several data sources. A DB underlying one of those data sources is down at the moment: IOError. Network adapter couldn't establish the connection & Socket read timed out.
Is there an annotation (or other means) of configuring Spring Boot such that it bypasses the culprit data source and still starts up: the DB is not essential in current development work. spring.datasource.continue-on-error=true doesn't seem to work. This is Spring 2.2.2.RELEASE.
using multiple datasource, so when your apps fail at start up your apps still work, i mean using memory db / sqlite to handle fail at connection error...

spring boot startup failure if mongo host not reachable

I have Spring boot mongo db app, when i start running this application if mongo host is alive, am able to see the my app is up and running successfully,
if my mongo host is down when i start my application my app failed to start.
is there any way even thought if mongo host is down my application should be up and running.
could someone please help me on this?
am using spring boot mongo properties in my application
spring.data.mongodb.repositories.enabled=true
spring.data.mongodb.port=27017
spring.data.mongodb.database=db
spring.data.mongodb.uri=mongodb://mongo-node-1.ballu/db
have same problem with spring boot kafka also.
Sorry for the previous comment. It was for excluding auto config beans, anyway
Is there any way even though if mongo host is down my application
should be up and running.
Yes,
spring.datasource.continue-on-error=true #Whether to stop if an error occurs while initializing the database.
as per spring doc
By default, Spring Boot enables the fail-fast feature of the Spring
JDBC initializer. This means that, if the scripts cause exceptions,
the application fails to start. You can tune that behavior by setting
spring.datasource.continue-on-error.
and as of spring kafka try this(i'm not sure if this meets your requirement)
spring.kafka.admin.fail-fast=true # Whether to fail fast if the broker is not available on startup.

Spring DevTools persistent session empty session map

I am trying to make Spring session persistence work but so far no luck.
So I start the app, do log in, change Java code to force restart and session is lost after that.
Enabled session persistence using server.servlet.session.persistent=true.
I see this property is picked up, and Tomcat is configured properly.
After some debugging I found out that the doUnload() method in org.apache.catalina.session.StandardManager is called properly but the session map is empty!
This happens in https://github.com/Oreste-Luci/apache-tomcat-8.0.26-src/blob/05aeff976f6a75346c95cf6d3a9c8add8b9cb0bc/java/org/apache/catalina/session/StandardManager.java#L338.
Any idea why this is happening? I did log in so I expect session to be created...
Spring Boot 2.1.1.RELEASE, Tomcat started at same version

Resources