The paid for version of intellij does not support remote editing either (sigh). 
Your dev setup sounds fine and you should not have to worry about your local 
machine since it is only used for editing. I only use intellij for code 
completion and class/method references. I always build/run on the command line.

Are you creating a log4j2.xml file or adding to the one already in the project, 
https://github.com/apereo/cas/blob/6.6.x/webapp/cas-server-webapp-resources/src/main/resources/log4j2.xml

When running, the default location for the log config file is 
/etc/cas/log4j2.xml (at least when using the overlay), so make sure you are 
editing the correct file. By setting your custom loggers to 'error' or 'fatal', 
you do not have to edit the log config.

When you say no records are in the database after a restart; are you talking 
about a cas restart, a couchdb restart, or both?
Is it possible that a cas restart re-initializes the db? (I have not used any 
cas db functionality, so am unfamiliar with its operation or config.)
Can you check that the records exist in couchdb?
How are cas tickets being stored?

I would guess that cas finds a record in couchdb by TGT id. If the ticket store 
is lost on a restart, then cas would have no way of finding anything in the db. 
(Again, I know nothing of how cas uses databases.)

Ray

On Thu, 2023-08-24 at 09:36 +0200, spfma.tech via CAS Community wrote:
Notice: This message was sent from outside the University of Victoria email 
system. Please be cautious with links and sensitive information.

Hi,

Thanks for your answer.
 
https://github.com/apereo/cas/blob/6.6.x/webapp/cas-server-webapp-resources/src/main/resources/log4j2.xml
I chose this storage system because my goal is to setup an active/passive pair 
of servers (with continous db replication on the passive side and automatic 
seemless failover)  in order to provider high availability.
It was the only supported backend I have found providing an easy way to achieve 
this goal (no three tier cluster with qorum and/or manual failover with 
conventional RDBMS).

But according you John's answer, I think I will have to change my mind anyway.

As my computer does not meet the requirements for serious Java developement, I 
am working remotely on an beefed up VM with plenty of RAM and CPU cores. And 
for that, VSCode has a very nice remote session extension, using ssh. Since 
Java related extensions don't seem to work correctly this way (maybe they work 
better localy, I don't have enough resources to test it), I am indeed using two 
shell sessions to run commands : one for building (clean build), and the other 
one for running (bootRun).

I have seen some posts here and there relating unexplainable problems with 
Gradle, and wiping out all the folders solved them. So I gave a try too !

My actual log4j config has a logger defined this way :

<Loggername="org.apereo.cas"level="debug">
<appender-refref="casFile"/>
<appender-refref="casConsole"/>
<!-- <appender-ref ref="casSyslog" />-->
</Logger>

And I am adding "LOGGER. debug" directives here in there. Should it be ok ?

I had a look at several IDE, and IDEA free has no remote support unfortunately. 
 Need to have a look at Eclipse and Netbeans too, but it seems they have the 
same limitations. So better make a wise choice before investing time and energy 
in such a complex product.

Regards

Le 23-Aug-2023 19:53:05 +0200, r...@uvic.ca a écrit:
Could you use a different storage system?

I do not see the couchdb module in the current development branch. Not sure if 
it is being removed or if a different module takes on that feature.

Instead of running gradlew in vscode, you can run it from the command line. The 
'clean' part of the command will remove all .class files; no need to get rid of 
gradle directories unless you are changing gradle version (which you should 
not).
Once you build the project, remove 'clean'; only modified packages will be 
rebuilt (will be fine for logging, but not for api changes).

It is possible that method is not being called. You could put your logging 
statement in every method in that class to be sure. Also, use error level 
logging. Default logging for that class may not show at info or debug. Or add 
to log4j2.xml:

<AsyncLogger name="org.apereo.cas.couchdb.gauth.credential" level="trace">

If you want a more 'capable' development environment, here are some notes on 
intellij (I think there is a free version), 
https://apereo.github.io/cas/development/developer/Build-Process.html#intellij-idea

Ray

On Wed, 2023-08-23 at 17:43 +0200, spfma.tech via CAS Community wrote:
Notice: This message was sent from outside the University of Victoria email 
system. Please be cautious with links and sensitive information.

Hi,

I am still trying to understand what is wrong with 
"cas-server-support-gauth-couchdb" (only the first authenticator is recorded in 
the database, none is working anymore after a restart).

As I am not a Java dev (I don't have the skills and don't have the most 
convenient tools), my idea was to add some logging directives here and there to 
trace the process, using the latest branch of the application source code (not 
the overlay one).

Can someone confirm I am doing the right way :
- add "import lombok.extern.slf4j.Slf4j;" if missing on the top of the class 
file
- anotate the class definition with "@Slf4j"
- put stuff like "LOGGER.debug" or "LOGGER.info" as needed

VSCode is my tool, and it seems convenient extensions for Java/Maven/Gradle are 
not able to handle a big project like CAS (language server crashing and 
restarting all the time, Gradle extensions unable to build a tree of all 
subprojects without crashing, ...) so I don't mind using the good old manual 
way instead of wasting time.

After modifying the code here and there, I rebuild the whole app with 
"./gradlew clean build --parallel --configure-on-demand --stacktrace 
--no-daemon -x checkstyleMain" at the root of the project.

And "cas/webapp/cas-server-webapp-jetty$ ../../gradlew bootRun --parallel 
--configure-on-demand --build-cache --stacktrace --no-daemon -x checkstyleMain" 
allows me to try it (we use it with Jetty in production).

The app is running, I can reproduce the problems but I have the feeling my 
modifications don't exist  as none of my custom logging messages is displayed.

For an example, I added a simple logging flag in this file 
"support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/credential/GoogleAuthenticatorAccountCouchDbRepository.java"
 this way :

@View(name="by_username", map="function(doc) { if(doc.secretKey) { 
emit(doc.username, doc) } }")
public 
List<CouchDbGoogleAuthenticatorAccount>findByUsername(finalStringusername) {
LOGGER.debug("[MY_DEBUG_STUFF] 
findByUsername@GoogleAuthenticatorAccountCouchDbRepository={}", username);
try {
return queryView("by_username",username.trim().toLowerCase());
} catch (finalDocumentNotFoundExceptione) {
LOGGER.trace(e.getMessage(), e);
}
return newArrayList<>(0);
}

as I think it's the one responsible for database lookup, according to the 
request I have seen coming on database side.

But nothing in the logs ... Maybe I am not tagging the right source file ?

So why not tweak a known existing log message, it is safer. In 
"support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/gauth/token/GoogleAuthenticatorCouchDbTokenRepository.java"
 I changed the message in "cleanInternal" method. The string "Removing tokens 
older than" is only found in this file, so I think it's spot on.

After rebuilding and restarting the application, I still get the original 
message in my logs.

DEBUG [org.apereo.cas.gauth.token.GoogleAuthenticatorCouchDbTokenRepository] - 
<Removing tokens older than [2023-08-23T17:37:11.946486]

Could someone tell me what I am missing or doing wrong ? Of course, I have 
deleted all Gradle dirs, used a find to delete all ".class" files and rebuild 
the projects several times but I am stuck.

Reagrds



________________________________
FreeMail powered by mail.fr<https://mail.fr>






________________________________
FreeMail powered by mail.fr<https://mail.fr>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/42006d77196fd7e3d3df86c06cd56eeefd1eee27.camel%40uvic.ca.

Reply via email to