Sunday, June 13, 2021

Small tip to improve your log statements in Java

 Have a look at the code below:


Now take a look at the below log output from running the above code:


The trade type is: ‘BLOCK’ so we would expect the method to return true. However, it is returning false. It is difficult to see what is going wrong from the above log statements.  

A useful tip to improve your logging is to surround the {} in your log statements with square brackets: [] as shown underlined in red below:


When we rerun the above code with the improved log statements, it is immediately clear what the issue is (trailing white space in the trade type):


This small change to your log statements can save you a lot of time when trying to investigate why your program is not working as expected. 



Minna no Nihongo Lesson 38 Renshuu B Answers

My answers to Minna no Nihongo Lesson 38 Renshuu B

If you see any mistakes, please let me know

 

1)

1.    ラッシュの電車で毎日通うのは大変です。

2.    毎日お酒を飲むのは体に悪いです。

3.    スポーツのあとで、シャワーを浴びるのは気持ちがいいです。

4.    電話しながら運転するのは危ないです。

 

2)

1.    わたしは海岸を散歩するのが好きです。

2.    わたしは負けるのが嫌いです。

3.    彼は子どもを褒めるのが上手です。

4.    彼はうそを言うのが下手です。

5.    彼女は走るのが速いです。

6.    彼女は朝起きるのが遅いです。

 

3)

1.    宿題をしましたが, きょうもって来るのを忘れました。

2.    友達に手紙を出しましたが,  切手をはりるのを忘れました。

3.    住所が変わりましたが, 彼女に連絡するのを忘れました。

4.    彼をコンサートに誘いましたが, 時間を言うのを忘れました。

 

4)

1.    佐藤さんが会社をやめるのを知っていますか。

2.    小川さんが入院するのを知っていますか。

3.    2000年前の町が発見されまったのを知っていますか。

4.    昨日のサッカーの試合は日本がブラジルに負けたのを知っていますか。

 

5)

1.    そのかばんを買うのはどこですか。

2.    講義が始まるのは何時ですか。

3.    電話を発明したのはだれですか。

4.    玄関の前に止めてあるのはだれの車ですか。

5.    あなたの国のお土産でいちばん有名のは何ですか。

6.    このカメラだけ値段が安いのはどうしてですか。

 

6)

1.    父が亡くなったのは3年まえです。

2.    彼女が研究するのは「源氏物語」です。

3.    子どもが通っているのはあの中学校です。

4.    桜の木の枝を折りるのはわたしです。

5.    1年でいちばん忙しいのは12月です。

6.    いちばん簡単のはこのやり方です。


My answers to Minna no Nihongo Lesson 47 Renshuu B

My answers to Minna no Nihongo Lesson 47 Renshuu B If you see any mistakes, please let me know 1) 1.     昨日の新聞によると、日本の女性は世界で一番長生きするそうで...