-
1. Re: Why do Entity objects write to Wildfly log and console, but Websocket Endpoint won't?
jaikiran Feb 10, 2020 9:19 PM (in response to gberish)Hello George,
I see that you are using java.util.logging package to do the logging. Is there any specific logging.properties that you are using for your application? Also, can you post the snippet of the code where the logging is being done? What level are you using to log that message (debug(), info())?
-
2. Re: Why do Entity objects write to Wildfly log and console, but Websocket Endpoint won't?
gberish Feb 11, 2020 12:00 PM (in response to gberish)Thanks jaikiran
I set my logging properties for the handler in the standalone-full.xml
<profile>
<subsystem xmlns="urn:jboss:domain:logging:3.0">
...
<console-handler name="MY-CONSOLE" autoflush="true">
<formatter>
<named-formatter name="MY-PATTERN"/>
</formatter>
<target name="System.out"/>
</console-handler>
...
<logger category="org.america3" use-parent-handlers="false">
<level name="INFO"/>
<handlers>
<handler name="WSTEST"/>
</handlers>
</logger>
...
<formatter name="MY-PATTERN">
<pattern-formatter pattern="MeMeMe%s%n"/>
</formatter>
Here is the code in my classes used to log
FROM Member.java
//constructors
public Member() {
System.out.println("\n************************ Member: System.out from Constructor");
logger.info("************************ Member: Logged from Constructor");
FROM WSEndpoint
@OnOpen
public void open(Session session) {
System.out.println("\n************************ WSEndpoint: System.out from OnOpen");
logger.info("************************ WSEndpoint: Logged from OnOpen");
}
Which should be called when the HTML script instatiates a new socket with
var socketURL = "ws://localhost:8080/WSTest/WSTestSocket";
function openUp (){
if (!appsocket) {
alert("Opening: appsocket " + socketURL);
appsocket = new WebSocket(socketURL);
alert("appsocket open: " + appsocket); **** This returns [object:Websocket]]
And this is what wildfly's log shows when it is started and deploys my EAR app:
The Name and Member entities are clearly logging to the console. See "MeMeMe"
And System.out is also logging to the console
10:46:40,763 INFO [stdout] (ServerService Thread Pool -- 66)
10:46:40,764 INFO [stdout] (ServerService Thread Pool -- 66) ************************ Member: System.out from Constructor
MeMeMe************************ Member: Logged from Constructor
10:46:40,796 INFO [stdout] (ServerService Thread Pool -- 66)
10:46:40,796 INFO [stdout] (ServerService Thread Pool -- 66) ************************ Name: System.out from Constructor
MeMeMe************************ Name: Logged from Constructor
But nothing is showing up from WSEndpoint.java
Hope you can suggest somewhere else to look.
This is killing me
-
3. Re: Why do Entity objects write to Wildfly log and console, but Websocket Endpoint won't?
jaikiran Feb 11, 2020 9:54 PM (in response to gberish)What is the fully qualified package name of the WSEndpoint?
-
4. Re: Why do Entity objects write to Wildfly log and console, but Websocket Endpoint won't?
gberish Feb 12, 2020 7:57 PM (in response to jaikiran)Cudos to jaikiran
Based on your hints I found I was right.
It was a dumb error that had nothing to do with logging..
The Ear had two modules:
WSTest.jar that deployed the Session Beans and
WSTest.war that deployed the HTML and script files,
And I had the socket class in WSTest.jar with the Session Beans.
I'm not sure if this is the only solution, but based on your suggestions I moved the socket to WSTest.war's META-INF/classes folder.
.
And all worked.
I wish I knew how to use the forum better.
But since this is under your reply, can I check you comment with Correct Answer to see that you get credit? You were the only programmer who helped,and I appreciate it.
-
5. Re: Why do Entity objects write to Wildfly log and console, but Websocket Endpoint won't?
jaikiran Feb 13, 2020 11:39 AM (in response to gberish)Hello George, I'm really glad that my hint helped you sort out the issue.
But since this is under your reply, can I check you comment with Correct Answer to see that you get credit?
I think you should mark your own answer as the correct one (that's a perfectly acceptable practice). That way other users get to know the exact change you did which got you past it.
P.S: If you still want to credit my previous reply, you can "Like" it (there's a like link in each post) or even mark the reply as "Helpful".