For debugging it’s often useful to do console.log(someObjectOrArray)
. However, if the array is long or the object deep, a lot will be truncated. Apparently there’s a util one can use to get a bit more control over this though:
import util from 'util'
console.log(
util.inspect(someObjectOrArray, {
colors: true,
depth: 3,
compact: false,
})
)
Just a note to self on how to get (in my case) IntelliJ to spit out all SQL statements happening during unit tests.
- Add the following to application.conf
- Add the following to logback.xml
<logger name="org.jdbcdslog.ConnectionLogger" level="OFF" />
<logger name="org.jdbcdslog.StatementLogger" level="INFO" />
<logger name="org.jdbcdslog.ResultSetLogger" level="OFF" />
Source: StackOverflow
Just a note for next time I need to mess with date/time format strings for PHP strftime calls, Apache log format configuration, etc…
🎈ðŸ‘🎉strftime.net
When developing it can sometimes be very useful to see exactly what queries are sent to the database.
Found out there’s something called a General Query Log, and enabling it was really easy. Just add the following to your my.{ini,cnf} file:
[mysqld]
general-log=1
general-log-file=queries.log
log-output=file
Restart the server and you should now find the log in your data directory (unless no queries done yet).
If you don’t know where your data directory is, just run this query:
SHOW VARIABLES WHERE variable_name = 'datadir'
With a hint of Social Ineptitude