Spring MVC

Whenever I Click on the
profile
profile
endpoint then my console is starting printing the image of the user in binary format that cause alot of lagging and stopping my program. Please Help. https://srcb.in/wGaSDYunV1p
56 Replies
JavaBot
JavaBotā€¢6mo ago
āŒ› This post has been reserved for your question.
Hey @Danix! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Danix
DanixOPā€¢6mo ago
Sorry here is the correct code link https://sourceb.in/wGaSDYunV1
JavaBot
JavaBotā€¢6mo ago
It looks like you are having issues with debugging or issues that can be solved using a debugger. Check out this article on dev.java to see how debugging works and how to use a debugger. This Stack Overflow question and its answers also explain debugging in general. These links describe how to use the debugger in some IDEs: ā€¢ Debugging in IntelliJ ā€¢ Debugging in Eclipse
dan1st
dan1stā€¢6mo ago
I guess it's printed inside finderUserImp.findByEmail(email) or maybe somewhere during view rendering
Danix
DanixOPā€¢6mo ago
I look inside the finderuserImp.findbyemail as well but not print statement was there ? @dan1st | Daniel
Danix
DanixOPā€¢6mo ago
No description
Danix
DanixOPā€¢6mo ago
This is what happens
dan1st
dan1stā€¢6mo ago
ok that seems to be debug logging from JSTL There are multiple ways of dealing with that Firstly, you could just disable debug logging so you don't get that output (assuming you don't need it)
Danix
DanixOPā€¢6mo ago
ok
20:29:53.239 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.view.JstlView - View name 'profile', model {movieFinderUser=com.moviefindercontrollers.model.MovieFinderUser@3cf06b6b, image=/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAgICAgJCAkKCgkNDgwODRMREBARExwUFhQWFBwrGx8bGx8bKyYuJSMlLiZENS8vNUROQj5CTl9VVV93cXecnNEBCAgICAkICQoKCQ0ODA4NExEQEBETHBQWFBYUHCsbHxsbHxsrJi4lIyUuJkQ1Ly81RE5CPkJOX1VVX3dxd5yc0f/CABEIDEcIggMBIgACEQEDEQH/xAAuAAEBAAMBAQAAAAAAAAAAAAAAAQIDBAUGAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAtiZYsyYGOxjWWNiZ67katmoYa8tSt8hu07tZp2NJss6
20:29:53.239 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.view.JstlView - View name 'profile', model {movieFinderUser=com.moviefindercontrollers.model.MovieFinderUser@3cf06b6b, image=/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAgICAgJCAkKCgkNDgwODRMREBARExwUFhQWFBwrGx8bGx8bKyYuJSMlLiZENS8vNUROQj5CTl9VVV93cXecnNEBCAgICAkICQoKCQ0ODA4NExEQEBETHBQWFBYUHCsbHxsbHxsrJi4lIyUuJkQ1Ly81RE5CPkJOX1VVX3dxd5yc0f/CABEIDEcIggMBIgACEQEDEQH/xAAuAAEBAAMBAQAAAAAAAAAAAAAAAQIDBAUGAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAtiZYsyYGOxjWWNiZ67katmoYa8tSt8hu07tZp2NJss6
These are the starting lines of the conosle but how to disable it
dan1st
dan1stā€¢6mo ago
Do you have an application.properties? If yes, can you please show it (ideally as text like you just did with the output here)
Danix
DanixOPā€¢6mo ago
nahh i dont have any application.properties bcz i am using simple Spring MVC not spring boot
dan1st
dan1stā€¢6mo ago
another way is to limit the console output. You can do that in the preferences under Run/Debug>Console/Limit console output
No description
dan1st
dan1stā€¢6mo ago
Do you have any logging configuration? For example a logback.xml?
Danix
DanixOPā€¢6mo ago
Danix
DanixOPā€¢6mo ago
no i am not using spring security as well but i have this
dan1st
dan1stā€¢6mo ago
Any other files related to logging? Are you passing any system properties? Can you show your dependencies? that option should work independently of that
Danix
DanixOPā€¢6mo ago
what do u mean by the term logging ?
Danix
DanixOPā€¢6mo ago
Danix
DanixOPā€¢6mo ago
@ @dan1st | Daniel
dan1st
dan1stā€¢6mo ago
Logging is when you there is diagnostic output from your application Which is done by a library (in your case logback)
dan1st
dan1stā€¢6mo ago
You could try something like this if you want to disable debug logging: https://stackoverflow.com/a/58746885/10871900
Stack Overflow
Disable DEBUG level logs in logback.xml keeping INFO and ERROR leve...
My logback.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <configuration> <jmxConfigurator/> <statusListener class="ch.qos.logback.core.status.NopStatusListen...
Danix
DanixOPā€¢6mo ago
but this problem is suddenly arrives bcz yesterday its not giving any issue but today it is ? why
dan1st
dan1stā€¢6mo ago
Stack Overflow
How to disable debug logs in spring
How to disable debug mode in my spring application. When i run my application in production it gives lot of debug logs statements and tomcat's log file take more space in disk. like below, 05:03:2...
dan1st
dan1stā€¢6mo ago
Was the image also printed before today? If the issue is Eclipse not responding, you can fix that by limiting the output
Danix
DanixOPā€¢6mo ago
yehh
dan1st
dan1stā€¢6mo ago
If you want Spring to stop putting that in the console, that's a different issue with a different fix https://discord.com/channels/648956210850299986/1251539126163869802/1251553366220214302
john
johnā€¢6mo ago
another way is to limit the console output. You can do that in the preferences under Run/Debug>Console/Limit console output
No description
dan1st
dan1stā€¢6mo ago
What's shown when opening that preference page?
Danix
DanixOPā€¢6mo ago
i did it but the output is coming same
Danix
DanixOPā€¢6mo ago
No description
dan1st
dan1stā€¢6mo ago
reduce the 320000 to a lower number
Danix
DanixOPā€¢6mo ago
how much ?
dan1st
dan1stā€¢6mo ago
you could try 32000 essentially higher number --> more lag but also more can be displayed in the console lower number-->less lag but you can also not display that much text in the console (it will erase what was printed at the beginning)
Danix
DanixOPā€¢6mo ago
still lagg alot even the ecplise not opening
dan1st
dan1stā€¢6mo ago
? It is specifically about responding when there's a lot of text in the console
Danix
DanixOPā€¢6mo ago
but why the problem is occuring
dan1st
dan1stā€¢6mo ago
With the output making Eclipse not respond? Well having a high number there means that Eclipse has to display a lot of text which can be slow
Danix
DanixOPā€¢6mo ago
but why the binary number is printing ?
dan1st
dan1stā€¢6mo ago
That's probably because debug logging is enabled and you should be able to disable it with that Like JSTL (the thing running JSP) is probably configured to print attributes to the console when debug logging is enabled
Danix
DanixOPā€¢6mo ago
so how can i off it through the post u send me ?
dan1st
dan1stā€¢6mo ago
So you have no logback.xml, right?
Danix
DanixOPā€¢6mo ago
yehh
dan1st
dan1stā€¢6mo ago
Then you can probably turn it off by creating a logback.xml in your src/main/resources with a content similar like this:
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<encoder>
<pattern>
%-4relative [%thread] %-5level %logger{30} - %msg%n
</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<encoder>
<pattern>
%-4relative [%thread] %-5level %logger{30} - %msg%n
</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
You might need to change <root level="DEBUG"> to <root level="INFO"> but I don't think that's necessary
Danix
DanixOPā€¢6mo ago
so where should i have to add it
dan1st
dan1stā€¢6mo ago
Insrc/main/resources/logback.xml I think
Danix
DanixOPā€¢6mo ago
yehh that solved the issue but how is this occuring and why even if i am not printing the image byte
JavaBot
JavaBotā€¢6mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Danix
DanixOPā€¢6mo ago
?
dan1st
dan1stā€¢6mo ago
It's not you printing it It's JSTL (a library you are using) printing it As I said before, JSTL is the thing that reads JSP files and converts HTML from it
Danix
DanixOPā€¢6mo ago
hmm ok ok but if i got any error then the console will print it right ? Can u give me a advice today i have completed my Spring JPA module so should i start Spring rest or spring security ?
dan1st
dan1stā€¢6mo ago
it should Depending on what is important to you But you might want to consider using Spring Boot
Danix
DanixOPā€¢6mo ago
yehh i started it they are new to me thats why i am asking to u bro
dan1st
dan1stā€¢6mo ago
Both are important tbh I think Spring JPA is probably the more complicated one
Danix
DanixOPā€¢6mo ago
do u have any doc where could i see all the topics cover under Spring JPA
dan1st
dan1stā€¢6mo ago
Spring Data JPA
Spring Data JPA
Level up your Java code and explore what Spring can do for you.
JavaBot
JavaBotā€¢6mo ago
šŸ’¤ Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server