Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing a google firebase connection

is there a way to test a google fire base connection from the UNIX command line?

I am working on an executable jar file, which works great locally, but cannot write to fire base. So I would like to find a way to test the connection.

I can ping my fire base url from the server.

thank you,

like image 518
utb Avatar asked Sep 07 '25 07:09

utb


2 Answers

If you want to see lots of details about the state of the SDK's connection to Firebase, turn on debug logging. You can do that with FirebaseDatabase.getInstance().setLogLevel(Level.DEBUG).

like image 146
Doug Stevenson Avatar answered Sep 09 '25 20:09

Doug Stevenson


Thanks Doug, this was exactly what I needed. It also helped me pinpoint the issue. I was simply unaware of the logging method for firebase.


For others who might have issues implementing:

Import Statement: (eclipse gives you options in my case)

import com.google.firebase.database.Logger.Level;

Set Doug's Log Level:

FirebaseDatabase.getInstance(fbconn).setLogLevel(Level.DEBUG);

Proceed to try to make your connection: (fbconn is FirebaseApp that I set with my details for firebase)

FirebaseDatabase defaultDatabase = FirebaseDatabase.getInstance(fbconn);
String strCurrentTimestamp = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss a").format(new Date());  
DatabaseReference dataRef = defaultDatabase.getReference().child("Firebase-Connection-Verified");
dataRef.setValue(strCurrentTimestamp);
like image 23
utb Avatar answered Sep 09 '25 21:09

utb