Fixed unicode username user creation error

The code tries to construct a byte string object to test the
length of the string field (The explicit construction of the
string object is neccessary as sometime v can be other types,
for example int). This will cause error if the string field
(v) is a unicode object.

Fixes bug #1166701

Change-Id: I73cee4da5c9f91ce135e7f81d88c979871f61767
Fixed logging usage instead of LOG

Change-Id: Ic181f7a453e3a72c4e2adc7894038f9256f33f0d
Merge "Fixed unicode username user creation error"
Merge "Fixed logging usage instead of LOG"