I am trying to add ignore configuration for Sentry, but it's not working, still receive that exception on Sentry page.
io.sentry:sentry-log4j2 version is 6.12.1 and Spring Boot version is 2.5.8.
sentry.ignored-exceptions-for-type=java.lang.RuntimeException,java.lang.IllegalStateException
This is the documentation that I am checking.
https://docs.sentry.io/platforms/java/guides/spring/configuration/
Any idea what can be the problem ?
Related
I am using Couchbase SDK along with Spring boot 2.6.x version. I am using the spring spring-data-couchbase:jar:4.4.0 which in turn has com.couchbase.client:java-client:jar:3.3.0 dependency. The issue, is when trying to execute cluster.query() methods, I need to see what query is getting executed. I need to enable debug logs. However, I have tried configuring it under properties for logging.level for the package com.couchbase.client to DEBUG level, nothing is showing up. I tried the similar config in log4j.xml as well and no luck either. Does couchbase uses any wierd property or is it not reading the properties specified from either log4j or spring's properties?
You may ask if raw query is passed then why log specifically, but this is required if using parameterised queries and to debug it.
How does one enable logging for couchbase if using plain sdk methods under spring's context ?
Can you enable couchbase specific properties of spring-data and not package within the application?
logging:
level:
org.springframework.data.couchbase.repository.query: DEBUG
This should help ! It won't require any external dependency or logging solutions
For the cluster, add ServiceType.QUERY to captureTraffic...
env.ioConfig(it -> it.captureTraffic(ServiceType.QUERY))
and also set the log level for the com.couchbase category to TRACE
Below exception handler that is common for all my controllers, is working fine except that I need to disable the WARN log from AbstractHandlerExceptionResolver class after processing the exception. Using Spring Web MVC 5.x version.
#ControllerAdvice
public class AllExceptionHandler{
#ExceptionHandler(SomeCustomException.class)
#ResponseStatus(HttpStatus.BAD_REQUEST)
public void exceptionHandler() {
}
}
This is the log that is generated which I'm trying to avoid:
02-20-2019 15:22:54,896 WARN [http-nio-8080-exec-1] (AbstractHandlerExceptionResolver.java:140) - Resolved [com.rasa.rrt.ste.controller.SomeCustomException]
I'm not using Spring Boot.
Tried to extend the above AllExceptionHandler class with ExceptionHandlerExceptionResolver and call warnLogCategory(null) in the AllExceptionHandler constructor, but it throws NullPointerException.
Also, I see on Google to set this property spring.mvc.log-resolved-exception=false to disable warning, but not sure where/how to set it.
You mentioned spring.mvc.log-resolved-exception=false as a possible solution:
Also, I see on google to set this property "spring.mvc.log-resolved-exception=false" to disable warning, but not sure where/how to set it.
The spring.mvc.log-resolved-exception property is a Spring Boot property, and would be set using standard Spring Boot externalized configuration mechanisms. Enabling the property causes Spring Boot to configure HandlerExceptionResolver beans to log exceptions when they otherwise wouldn't.
Whether to enable warn logging of exceptions resolved by a "HandlerExceptionResolver", except for "DefaultHandlerExceptionResolver".
Since you've stated you're not using Spring Boot, this property is not applicable to your scenario.
You can disable this warning log in your logback configuration,
by specifying in my case in 'logback-spring.groovy' following line
logger("org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver", ERROR)
I know that this is a very trivial question but please suggest me to find the way. Sometimes when I start Spring Boot server, it stops but it does not display the complete error/exception stack trace. Think of situation that spring boot server has been started in 8080 port and if somebody starts in 8080 port, it should clearly display that java.net.BindException. But in my case server simply aborts.
I normally find the issue from the IDE like eclipse/Idea when I start the server in debug mode. But how to find the error when somebody starts spring boot server using command prompt ? There may be many errors for which spring boot is unable to start. My question is what configurations should be added in application.properties to know more details about the error/s for which spring boot is not getting started. Currently I am using Spring Boot 2.1.1.RELEASE version. Please help me fix this.
To see more details of the actions being carried out for a spring boot application, change the log level to debug. You can do it just by simply adding below lines in application.property/yaml file.
logging.level.=DEBUG
Or for web applications you can try
logging.level.org.springframework.web: DEBUG
Add the below property in application.xml - worked in Spring boot 2.2.4
logging.level.root:ERROR
I've been trying to figure out what I'm missing with my RestTemplate setup (particularly OAuth2RestTemplate) so I want to see the logs for debugging. I found one possible solution for it, but nothing about the operation of the RestTemplate gets shown.
What I've done so far is to replace the default Logback logging mechanism in my Spring Boot app by following the configuration shown here. When I run my Spring Boot application after changing the logging dependencies, all I see on the console is the Spring logo (in ASCII) and nothing else. I've already defined a log4j-spring.properties in src/main/resources with the property defined in the previous link.
What else am I missing here? Do I need to run my Spring Boot app in debug mode? If so, how do I do that? Also, how do I set this up using the default Logback mechanism?
Im having some weird issues using spring security. When i try to start my tomcat server, the following exception is thrown:
Couldn't locate: org.springframework.ldap.core.support.BaseLdapPathContextSource. If you are using LDAP with Spring Security, please ensure that you include the spring-ldap jar file in your application;
I have almost every spring library included in my maven dependencies:
spring-security-web-3.1.4.RELEASE.jar
spring-security-core-3.1.4.RELEASE.jar
spring-security-config-3.1.4.RELEASE.jar
spring-security-ldap-3.1.4.RELEASE.jar
spring-security-acl-3.1.4.RELEASE.jar
spring-security-taglibs-3.1.4.RELEASE.jar
spring-ldap-core-1.3.2.RELEASE.jar
spring-core-3.1.4.RELEASE.jar
spring-beans-3.1.4.RELEASE.jar
spring-aop-3.1.4.RELEASE.jar
spring-web-3.1.4.RELEASE.jar
spring-context-3.1.4.RELEASE.jar
spring-jdbc-3.1.4.RELEASE.jar
spring-tx-3.1.4.RELEASE.jar
spring-asm-3.1.4.RELEASE.jar
spring-expression-3.0.7.RELEASE.jar
What could be possibly causing this problem? Thanks in advance.
Solved my problem by simply downgrading to a older version of spring security. No problems happened since then.