ClojureScript get logs in serverside - clojure

How using Clojurescript get logs in serverside. I am using taoensso.timbre for logging and some of those logs are displayed in browsers console. How to make logs appear on the machine where Leiningen process started. I am using Figwheel and wanting to push all the logs into servers console. Is there a possibility to do so?
Or maybe a browser supports that?

More than likely, you'll want to wrap the timbre logging functions. You can write a function with the same signature as your logger, and make it responsible for both local and remote logging. After using the vanilla logging to report to the javascript console, you'll want to make an async request with a library like https://github.com/JulianBirch/cljs-ajax to your logging service of choice.

Related

Catching Server Error 500 using logging in Django (Server gunicorn)

I have an application deployed on Heroku and sometimes it throws the server error 500 randomly. I am trying to implement logging in my project. I am reading the docs but I am missing some critical piece of information. The docs say, Once you have configured your loggers, handlers, filters and formatters, you need to place logging calls into your code. My question is where exactly to put the logging code because I have already used try-except for all the parts, as far as I know, that may throw an error?
I have done a tutorial on the topic and reading the docs but that doesn't seem to convey the message to me.
I also sometimes deploy to Heroku, and like the combination of Papertrail and Sentry.
Papertrail I use for logging, including print statements to the console.
Sentry I setup for the error handling, such as what you mention random 500 errors. The plugin for Django automatically connects the 500 errors you see under debug mode and sends that information to their cloud for further processing
For Heroku both are readily available on the marketplace

Issue trying to have an Ajax Post within Google App Script HTMLService (Caja interference?)

I have a web page made with HtmlServices.
This page has a form I want to submit to a GAS web app made to behave as a web service.
When I use google app script UrlFetch to call my web service from my first GAS app, I very often get a timeout. Unfortunately we cannot set the GAS UrlFetch timeout value which I think is around 10s. 10s is not enough for a GAS app to copy a file, open/edit a spreadsheet and send an email!
So I decided to use Jquery and do an ajax post (because I can set the timeout value) within my web page built with HtmlServices. (so my page is sanitized by Google Caja). Jquery is said to be supported by Caja.
But I noticed that the Ajax URL is always rewritten to be the first web app URL (the url I want to post to is changed by Caja I assume). Seems to me that Google's Caja is preventing that Ajax call.
I could not find anything on Caja / Ajax post limitations within a GAS HtmlService.
Would you have suggestions on how to call a web service from a GAS Web App, without having the limitation of the GAS timeout?
The best suggestion I can give for right now is to use JSONP instead of Ajax to make the call. You should not see timeouts in that case, and it should work fine.
Couple of things
AJAX calls (with jQuery or vanilla JS) from a web app deployed on script.google.com to a content service deployed on script.google.com does not work. I've confirmed this and I believe this is a security restriction. I tried a few different workarounds and this looks like there is no short term options.
Regarding the server side option with UrlFetchApp. I believe the timeout is actually 30 seconds. However, that might still not be enough and it looks you are running into frequently enough.
So basically the 3rd (less optimal) option that I would recommend is a "queue" based approach. In this approach - have your HTML web app call a ScriptDb queue. Then you can have a timed trigger (every minute or every hour) that runs as you to perform the requisite operations. Just share the same script library between both scripts so you can share the script DB reference for the queue.
According to this answer from Eric Koleda, Caja was removed from Google Apps Script, but still the client-side code passed to the HtmlService is satinized some way and still there are restrictions. From https://developers.google.com/apps-script/guides/html/restrictions
HTTPS required for active content
"Active" content like scripts, external stylesheets, and XmlHttpRequests must be loaded over HTTPS, not HTTP.

Separating jetty and application log files

I am using slf4j with Java Util Logging, and my application logs are directed through Jetty.
How can I get separate output of Jetty startup logs and my application logs. Right now, they are both logged into the same file under jetty/logs.
How can I control the Jetty startup log format?
e.g. I want to change the date format from default "2012-09-13 14:55:36.178:INFO..." to "Sept 13, 2012 14:55:36.178:INFO..." in Jetty logs.
You can take a look at this page for inspiration:
http://wiki.eclipse.org/Jetty/Tutorial/Sifting_Logs_with_Logback
Long story short, once you have the slf4j-api in the mix then jetty turns logging over to it so you are able to configure whatever you want via slf4j configuration mechanisms.

ATL Web service Logging

I have created a c++ ATL web service in visual studio 2005. I want to have detailed logs for my web service as what request come or weather any exception happened during the Database call.
I am hosting my web service through IIS. I know that IIS create a log file if logging is enabled But i want to have some more control over those logs in terms of format.
Is there any method to use IIS system itself to implement our own logs inside that log file or
Should I implement a multithreaded logging system which will push logs to a text file.
Thanks
If you want logging beyond what IIS offers natively, you will either have to implement your own logger or make use of any of dozens of loggers already out there.
One that a lot of people love is Peantheios: http://www.pantheios.org/
There are many out there.
The simple answer to your question, though, is that IIS does not have built-in facilities for logging beyond what you see in the GUI.

Django development console custom/debug messages

Is there a way to print messages to Django development console?
I'm running 1.1 Django in buildout environment.
So running bin/django runserver (manage.py runserver) it shows development console where it writes resources, actions taken (equivalent of apache access/error logs(?)).
I want to print custom messages to that console for debugging purposes that it wouldn't kill the action just notice me.
Should i use logging module or is there other way?
If you're sure you just want it in development, you can simply use print - the message appears in the console.
However, you will need to delete the print statement before you deploy to production, as this will cause an error with Apache.
A better long-term solution is to use the logging module, configured to output to the console.