DLOGTIME complexity class and testing the length of the input string
It is hard to answer the question without further context.

Complexity is typically defined in terms of the size of the input (the number of bits needed to represent the input) and therefor depends on the representation you choose for the inputs. (More formally, a language or a formal computational problem is defined over strings of the alphabet, and the complexity is defined based on that, how you interpret these strings as objects (e.g. graphs, natural numbers, etc.) doesn't have an effect on the complexity, a "problem" corresponds to several (formal) computational problems based on the representations used.)

The complexity class $\mathsf{DLogTime}$ is defined as deterministic logarithmic time in the input size, $n$ is the size of the input. I guess you are confused because we typically use Turing machines for defining complexity classes but that may not make sense for sublinear time since one cannot even read the input. For sublinear time the model of computation is typically considered to be Random Access Machines where one can access any bit of the input directly without going over all previous bits using indexes (kind of similar to how memory works in real computers). 

One can find the length of the input in two steps using an index variable (a binary number):


Start from 1 and repeatedly double the value till the memory square corresponding to it is blank (an upper bound on the length of the input),
Do a binary search to find the last nonblank symbol. (Blank symbol is not used in the input.)


If the input is a string of length $n$ then this algorithm will find the size of the input in binary in time $O(\lg n)$.